Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
Select ├── SelectLabel (optional) ├── SelectControl │ ├── SelectTrigger │ │ ├── SelectValue │ │ └── SelectIndicator │ └── SelectClearTrigger (optional) ├── SelectPositioner │ └── SelectContent │ ├── SelectItemGroup │ │ ├── SelectItemGroupLabel │ │ └── SelectItem │ │ ├── SelectItemText │ │ └── SelectItemIndicator │ └── SelectSeparator (optional) └── SelectHiddenSelect
Examples
Controlled
Loading...
Default
Loading...
Disabled
Loading...
Groups
Loading...
Invalid State
Loading...
List
Loading...
Long List
Loading...
Multiple Selection
Loading...
Sizes
Loading...
With Icons
Loading...
API Reference
Select
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
translations | IntlTranslations | undefined | — | Configures translations. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
name | string | undefined | — | Name used when submitting the value with a form. |
form | string | undefined | — | Associates the control with a form by ID. |
autoComplete | string | undefined | — | Configures auto complete. |
disabled | boolean | undefined | false | Disables interaction with the component. |
invalid | boolean | undefined | — | Marks the associated form control as invalid. |
readOnly | boolean | undefined | false | Prevents changes while preserving focus and navigation. |
required | boolean | undefined | false | Marks the associated form control as required. |
closeOnSelect | boolean | undefined | true | Configures close on select. |
onSelect | ((details: SelectionDetails) => void) | undefined | — | Runs when select changes. |
onHighlightChange | ((details: HighlightChangeDetails<T>) => void) | undefined | — | Runs when highlight changes. |
onValueChange | ((details: ValueChangeDetails<T>) => void) | undefined | — | Runs when value changes. |
onOpenChange | ((details: OpenChangeDetails) => void) | undefined | — | Runs when open changes. |
positioning | PositioningOptions | undefined | — | Configures floating-element placement and collision handling. |
value | string[] | undefined | — | Current value when the component is controlled. |
defaultValue | string[] | undefined | — | Initial value when the component is uncontrolled. |
highlightedValue | string | null | undefined | — | Configures highlighted value. |
defaultHighlightedValue | string | null | undefined | — | Configures default highlighted value. |
loopFocus | boolean | undefined | — | Configures loop focus. |
multiple | boolean | undefined | false | Allows more than one value to be selected or expanded. |
open | boolean | undefined | — | Whether the component is open when controlled. |
defaultOpen | boolean | undefined | — | Initial open state when uncontrolled. |
scrollToIndexFn | ((details: ScrollToIndexDetails) => void) | undefined | — | Configures scroll to index fn. |
composite | boolean | undefined | — | Configures composite. |
deselectable | boolean | undefined | — | Configures deselectable. |
Context, Hooks, and Types
| Export | API |
|---|---|
SelectContext | Render-prop component that exposes component state and actions. |
SelectRootProvider | Provides an externally created API to the component tree. |
useSelect | Creates or accesses the component API. |
useSelectContext | Returns the nearest component API. |
SelectValueChangeDetails | Type for the details object passed to the matching change callback. |
Utilities and Supporting Types
| Export | API |
|---|---|
createListCollection | Creates the typed collection consumed by the component. |
CollectionItem | Supporting type or utility exported with the component. |
ListCollection | Supporting type or utility exported with the component. |
Angular
React
Solid
Svelte
Vue