Components
Select

Select

A flexible and customizable dropdown select component.

API reference docs for the component. Learn about the props, CSS, and other APIs of this exported module.

SelectProps

items

T[]

The options of the select

closeOnSelect

boolean

Whether the select should close after an item is selected

defaultValue

string[]

dir

'ltr' | 'rtl'

The document's text/writing direction.

disabled

boolean

Whether the select is disabled

form

string

The associate form of the underlying select.

getRootNode

() => ShadowRoot | Node | Document

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

highlightedValue

string

The key of the highlighted item

id

string

The 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.

invalid

boolean

Whether the select is invalid

isItemDisabled

(item: T) => boolean

Whether the item is disabled

itemToString

(item: T) => string

The label of the item

itemToValue

(item: T) => string

The value of the item

loop

boolean

Whether to loop the keyboard navigation through the options

multiple

boolean

Whether to allow multiple selection

name

string

The `name` attribute of the underlying select.

onFocusOutside

(event: FocusOutsideEvent) => void

Function called when the focus is moved outside the combobox

onHighlightChange

(details: HighlightChangeDetails<T>) => void

The callback fired when the highlighted item changes.

onInteractOutside

(event: InteractOutsideEvent) => void

Function called when an interaction happens outside the combobox

onOpenChange

(details: OpenChangeDetails) => void

Function called when the popup is opened

onPointerDownOutside

(event: PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the combobox

onValueChange

(details: ValueChangeDetails<T>) => void

The callback fired when the selected item changes.

open

boolean

Whether the select menu is open

positioning

PositioningOptions

The positioning options of the menu.

readOnly

boolean

Whether the select is read-only

selectOnBlur

boolean

Whether to select the highlighted item when the user presses Tab, and the menu is open.

value

string[]

The keys of the selected items

SelectContext

clearTriggerProps

WithoutRef< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> >

clearValue

(value?: string | undefined) => void

Function to clear the value of the combobox

close

() => void

Function to close the combobox

contentProps

WithoutRef<HTMLAttributes<HTMLElement>>

controlProps

WithoutRef<HTMLAttributes<HTMLElement>>

focus

() => void

Function to focus on the combobox input

getItemGroupLabelProps

(props: ItemGroupLabelProps) => WithoutRef<HTMLAttributes<HTMLElement>>

getItemGroupProps

(props: ItemGroupProps) => WithoutRef<HTMLAttributes<HTMLElement>>

getItemIndicatorProps

(props: ItemProps<any>) => WithoutRef<HTMLAttributes<HTMLElement>>

getItemProps

(props: ItemProps<any>) => WithoutRef<HTMLAttributes<HTMLElement>>

getItemState

(props: ItemProps<any>) => ItemState

Returns the state of a combobox item

getItemTextProps

(props: ItemProps<any>) => WithoutRef<HTMLAttributes<HTMLElement>>

hasSelectedItems

boolean

Whether there's a selected option

hiddenSelectProps

WithoutRef< DetailedHTMLProps<SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> >

highlightValue

(value: string) => void

The value of the combobox input

isFocused

boolean

Whether the select is focused

isOpen

boolean

Whether the select is open

labelProps

WithoutRef< DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> >

open

() => void

Function to open the combobox

positionerProps

WithoutRef<HTMLAttributes<HTMLElement>>

rootProps

WithoutRef<HTMLAttributes<HTMLElement>>

selectedItems

T[]

The selected items

selectValue

(value: string) => void

Function to select a value

setCollection

(collection: Collection<T>) => void

Function to set the collection of items

setValue

(value: string[]) => void

Function to set the value of the combobox

triggerProps

WithoutRef< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> >

value

string[]

The selected item keys

valueAsString

string

The string representation of the selected items

highlightedItem

T

The highlighted item

highlightedValue

string

The value of the highlighted item

SelectItemProps

item

any

SelectContentProps

lazyMount

boolean

Whether to enable lazy mounting. Defaults to `false`.

onExitComplete

() => void

present

boolean

unmountOnExit

boolean

Whether to unmount on exit. Defaults to `false`.

SelectItemGroupProps

id

string

SelectItemGroupLabelProps

htmlFor

string