Skip to content

Select

A dropdown for selecting one option from a list, with support for grouping and placeholders. Built on native `<select>` element.

Terminal window
bunx bejamas add select
---
import Select from '@/components/ui/Select.astro';
---
<Select>
<Select part="indicator" />
<Select part="control">
<Select part="option" value="apple">Apple</Select>
<Select part="option" value="banana">Banana</Select>
</Select>
</Select>
  • root (default): wrapper container (relative)
  • control: native <select> element
  • option: native <option> element
  • group: native <optgroup> element
  • placeholder: hidden, selected <option> for placeholder text
  • indicator: decorative dropdown icon (optional)

Placeholder is a hidden, selected option for placeholder text, it must be a child of the control part.

Built at Bejamas