Select
v0.5.0StableA bare select control (built on Radix's `Select`) — the Radix trigger button is this component's own root element. It has no built-in label/hint/error; wrap it in `FormField` for that chrome.
A bare select control (built on Radix's Select) — the Radix trigger button is this component's own root element. It has no built-in label/hint/error; wrap it in FormField for that chrome.
Usage
Pass invalid (adds the --invalid modifier and sets aria-invalid) to visually mark the field as invalid (pair with FormField's error prop for the message).
Examples
Open all 4 →Properties
Select props
| Prop | Type | Default | Description |
|---|---|---|---|
options* | SelectOption[] | — | Options rendered in the dropdown |
asChild | boolean | — | — |
className | string | — | Additional class names to merge with the component root element |
defaultValue | string | — | Initial selected value for uncontrolled usage |
invalid | boolean | false | Marks the field as invalid: adds the `--invalid` modifier and sets `aria-invalid="true"` |
name | string | — | Form field name submitted with the value |
onValueChange | ((value: string) => void) | — | Called with the new value when the selection changes |
placeholder | string | — | Text shown when no value is selected |
required | boolean | — | Marks the field as required for form validation |
value | string | — | Controlled selected value |
Also accepts the native attributes of its root element (className, aria-*, event handlers, …).