Installation
Add Component
Copy the code snippet below into you components folder.
Integrate Recipe
Integrate this recipe in to your Panda config.
Usage
Examples
Size
Use the size prop to change the size of the select component.
Option Group
Use the Select.ItemGroup component to group select options.
Props
Root
| Prop | Default | Type | 
|---|---|---|
| collection* | ListCollection<T>The collection of items | |
| variant | 'outline' | 'outline' | 'surface' | 
| size | 'md' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 
| closeOnSelect | true | booleanWhether the select should close after an item is selected | 
| composite | true | booleanWhether the select is a composed with other composite widgets like tabs or combobox | 
| lazyMount | false | booleanWhether to enable lazy mounting | 
| loopFocus | false | booleanWhether to loop the keyboard navigation through the options | 
| skipAnimationOnMount | false | booleanWhether to allow the initial presence animation. | 
| unmountOnExit | false | booleanWhether to unmount on exit. | 
| asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
| defaultHighlightedValue | stringThe initial value of the highlighted item when opened. Use when you don't need to control the highlighted value of the select. | |
| defaultOpen | booleanWhether the select's open state is controlled by the user | |
| defaultValue | string[]The initial default value of the select when rendered. Use when you don't need to control the value of the select. | |
| deselectable | booleanWhether the value can be cleared by clicking the selected item. **Note:** this is only applicable for single selection | |
| disabled | booleanWhether the select is disabled | |
| form | stringThe associate form of the underlying select. | |
| highlightedValue | stringThe controlled key of the highlighted item | |
| id | stringThe unique identifier of the machine. | |
| ids | Partial<{
  root: string
  content: string
  control: string
  trigger: string
  clearTrigger: string
  label: string
  hiddenSelect: string
  positioner: string
  item: (id: string | number) => string
  itemGroup: (id: string | number) => string
  itemGroupLabel: (id: string | number) => string
}>The ids of the elements in the select. Useful for composition. | |
| immediate | booleanWhether to synchronize the present change immediately or defer it to the next frame | |
| invalid | booleanWhether the select is invalid | |
| multiple | booleanWhether to allow multiple selection | |
| name | stringThe `name` attribute of the underlying select. | |
| onExitComplete | VoidFunctionFunction called when the animation ends in the closed state | |
| onFocusOutside | (event: FocusOutsideEvent) => voidFunction called when the focus is moved outside the component | |
| onHighlightChange | (details: HighlightChangeDetails<T>) => voidThe callback fired when the highlighted item changes. | |
| onInteractOutside | (event: InteractOutsideEvent) => voidFunction called when an interaction happens outside the component | |
| onOpenChange | (details: OpenChangeDetails) => voidFunction called when the popup is opened | |
| onPointerDownOutside | (event: PointerDownOutsideEvent) => voidFunction called when the pointer is pressed down outside the component | |
| onSelect | (details: SelectionDetails) => voidFunction called when an item is selected | |
| onValueChange | (details: ValueChangeDetails<T>) => voidThe callback fired when the selected item changes. | |
| open | booleanWhether the select menu is open | |
| positioning | PositioningOptionsThe positioning options of the menu. | |
| present | booleanWhether the node is present (controlled by the user) | |
| readOnly | booleanWhether the select is read-only | |
| required | booleanWhether the select is required | |
| scrollToIndexFn | (details: ScrollToIndexDetails) => voidFunction to scroll to a specific index | |
| value | string[]The controlled keys of the selected items | 
Item
| Prop | Default | Type | 
|---|---|---|
| asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
| item | anyThe item to render | |
| persistFocus | booleanWhether hovering outside should clear the highlighted state | 
ValueText
| Prop | Default | Type | 
|---|---|---|
| asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
| placeholder | stringText to display when no value is selected. |