Select

Displays a list of options for the user to pick from.

Loading...

Anatomy

<Select.Root>
  <Select.Label />
  <Select.Control>
    <Select.Trigger>
      <Select.ValueText />
    </Select.Trigger>
    <Select.ClearTrigger />
    <Select.Indicator />
  </Select.Control>
  <Select.Positioner>
    <Select.Content>
      <Select.ItemGroup>
        <Select.ItemGroupLabel />
        <Select.Item>
          <Select.ItemText />
          <Select.ItemIndicator />
        </Select.Item>
      </Select.ItemGroup>
    </Select.Content>
  </Select.Positioner>
  <Select.HiddenSelect />
</Select.Root>

Examples

Controlled

Use value and onValueChange to control the selected items.

Root Provider

Use RootProvider with the useSelect hook to access the state and methods from outside the component.

Multiple

Set multiple to allow selecting more than one item.

Grouping

Group options into categories:

  • Set groupBy on the collection to define the groups.
  • Call collection.group() to get the grouped items.
  • Render them with Select.ItemGroup and Select.ItemGroupLabel.

With Tabs

Render tabs in the content to switch between two lists, like branches and tags.

Field

Field wires up the label, helper text, error text and ARIA attributes.

Form Usage

Integrate the select with a form library.

Async Loading

Load items asynchronously when the select opens.

Lazy Mount

Use lazyMount and unmountOnExit to mount content only when needed.

Select on Highlight

Select items as they are highlighted by hover or keyboard.

Max Selection

Limit how many items a multiple select accepts.

Select All

Call selectAll() from the select context to select every item.

Overflow

Set positioning.fitViewport to keep a long list within the viewport. Add a max-height on the content to make it scroll.

Virtualized

Use the Virtualizer to render only visible options in large collections. Render Select.List as ListVirtualizer.Root and each Select.Item as ListVirtualizer.Item. Pass scrollToIndexFn so keyboard navigation can reach unmounted options.

Guides

Type Safety

Use the Select.RootComponent type to build wrappers that keep collection items typed.

const Select: ArkSelect.RootComponent = (props) => {
  return <ArkSelect.Root {...props}>{/* ... */}</ArkSelect.Root>
}

onValueChange and other callbacks then infer the item type:

const App = () => {
  const collection = createListCollection({
    initialItems: [
      { label: 'React', value: 'react' },
      { label: 'Vue', value: 'vue' },
    ],
  })
  return (
    <Select
      collection={collection}
      onValueChange={(e) => {
        // e.items is typed as Array<{ label: string, value: string }>
        console.log(e.items)
      }}
    >
      {/* ... */}
    </Select>
  )
}

Hidden Select

Select.HiddenSelect renders a visually hidden native <select>. It enables:

  • Form submission: native submission and serialization work because a real <select> exists.
  • Browser auto-fill: browsers can fill it from previously submitted data.
  • Progressive enhancement: forms still work if JavaScript fails to load.
<Select.Root>
  <Select.HiddenSelect />
  {/* Other Select components */}
</Select.Root>

It stays in sync with the select's value.

Virtualization

Avoid Select.HiddenSelect with virtualized collections. It renders an <option> for every item. Use Select.HiddenInput instead. It renders one hidden <input> per selected value, using the root's name, form and disabled:

<Select.Root collection={collection} name="item">
  {/* Other Select components */}
  <Select.HiddenInput />
</Select.Root>

Empty State

Check the collection size with useSelectContext to show an empty state:

const SelectEmpty = (props: React.ComponentProps<'div'>) => {
  const select = useSelectContext()
  if (select.collection.size === 0) {
    return <div {...props} role="presentation" />
  }
  return null
}

Render it inside the content:

<Select.Content>
  <SelectEmpty>No items to display</SelectEmpty>
  {/* Your items */}
</Select.Content>

Available Size

Select.Positioner exposes these CSS variables for styling Select.Content:

/* width of the select trigger */
--reference-width: <pixel-value>;
/* width of the available viewport */
--available-width: <pixel-value>;
/* height of the available viewport */
--available-height: <pixel-value>;

For example, to keep the content within the available height:

[data-select-content] {
  max-height: calc(var(--available-height) - 100px);
}

API Reference

Props

Root

Defines the <div> element.

AttributeDefaultType
collection
ListCollection<T, never>

The collection of items

alignItemWithTriggerfalse
boolean

Whether the positioner overlaps the trigger so the selected item's text is aligned with the trigger's value text. Only applies to mouse/keyboard input and is automatically disabled for touch or when there is not enough space.

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
autoComplete
string

The autocomplete attribute for the hidden select. Enables browser autofill (e.g. "address-level1" for state).

closeOnSelecttrue
boolean

Whether the select should close after an item is selected

defaultHighlightedValue
string

The initial value of the highlighted item when opened. Use when you don't need to control the highlighted value of the select.

defaultOpen
boolean

Whether 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
boolean

Whether the value can be cleared by clicking the selected item. **Note:** this is only applicable for single selection

disabled
boolean

Whether the select is disabled

form
string

The associate form of the underlying select.

hideMode'display-none'
HideMode

How to hide content when mounted but not present. - `'display-none'`: HTML `hidden` attribute. Effects stay alive. - `'activity'`: React 19 `<Activity mode="hidden">`. Effects pause. Requires React 19+.

highlightedValue
string

The controlled key of the highlighted item

id
string

The unique identifier of the machine.

ids
Partial<{ root: string content: string list: string input: 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
boolean

Whether to synchronize the present change immediately or defer it to the next frame

initialFocusEl
() => HTMLElement | null

Element to receive focus when the select is opened. Defaults to the first tabbable element inside the content (typically the list).

invalid
boolean

Whether the select is invalid

lazyMountfalse
boolean

Whether to enable lazy mounting

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

onEnterComplete
VoidFunction

Function called when the animation ends in the open state

onExitComplete
VoidFunction

Function called when the animation ends in the closed state

onFocusOutside
(event: FocusOutsideEvent) => void

Function called when the focus is moved outside the component

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 component

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 component

onSelect
(details: SelectionDetails) => void

Function called when an item is selected

onValueChange
(details: ValueChangeDetails<T>) => void

The callback fired when the selected item changes.

open
boolean

Whether the select menu is open

popupType'listbox'
'dialog' | 'listbox'

The ARIA pattern of the popup. Drives `aria-haspopup` on the trigger and the `role` of the content element. - `"listbox"` (default) — content is a passthrough wrapper; the list bears `role="listbox"`. - `"dialog"` — content is announced as a dialog; useful when composing search inputs, tabs, or other widgets inside the popup.

positioning
PositioningOptions

The positioning options of the menu.

present
boolean

Whether the node is present (controlled by the user)

readOnly
boolean

Whether the select is read-only

render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<SelectRootState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

required
boolean

Whether the select is required

scrollToIndexFn
(details: ScrollToIndexDetails) => void

Function to scroll to a specific index

skipAnimationOnMountfalse
boolean

Whether to allow the initial presence animation.

translations
IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

unmountOnExitfalse
boolean

Whether to unmount on exit.

value
string[]

The controlled keys of the selected items

AttributeDescription
[data-select-root]<uid>
[data-state]"open" | "closed"
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-readonly]Present when read-only

ClearTrigger

Defines the <button> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-clear-trigger]<uid>
[data-invalid]Present when invalid

Content

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<SelectContentState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-content]<uid>
[data-state]"open" | "closed"
[data-placement]The placement of the content
[data-align-with-trigger]
[data-side]The side of the trigger that the content is positioned on
[data-nested]listbox
[data-has-nested]listbox
CSS VariableDescription
--layer-indexThe index of the dismissable in the layer stack
--nested-layer-countThe number of nested selects

Control

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-control]<uid>
[data-state]"open" | "closed"
[data-focus]Present when focused
[data-disabled]Present when disabled
[data-invalid]Present when invalid

HiddenInput

Defines the <input> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

HiddenSelect

Defines the <select> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

Indicator

Defines the <span> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-indicator]<uid>
[data-state]"open" | "closed"
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-readonly]Present when read-only

ItemGroupLabel

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

ItemGroup

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-item-group]<uid>
[data-disabled]Present when disabled

ItemIndicator

Defines the <span> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-item-indicator]<uid>
[data-state]"checked" | "unchecked"

Item

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
item
any

The item to render

persistFocus
boolean

Whether hovering outside should clear the highlighted state

render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<SelectItemState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-item]<uid>
[data-value]The value of the item
[data-state]"checked" | "unchecked"
[data-highlighted]Present when highlighted
[data-disabled]Present when disabled

ItemText

Defines the <span> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-item-text]<uid>
[data-state]"checked" | "unchecked"
[data-disabled]Present when disabled
[data-highlighted]Present when highlighted

Label

Defines the <label> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-label]<uid>
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-readonly]Present when read-only
[data-required]Present when required

List

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-list]<uid>
[data-activedescendant]The id the active descendant of the list

Positioner

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-positioner]<uid>
[data-nested]Present when the positioner is nested within another {{widget}}
[data-has-nested]Present when the positioner has nested {{widget}}s
CSS VariableDescription
--reference-widthThe width of the reference element
--reference-heightThe height of the root
--available-widthThe available width in viewport
--available-heightThe available height in viewport
--xThe x position for transform
--yThe y position for transform
--transform-originThe transform origin for animations

RootProvider

Defines the <div> element.

AttributeDefaultType
value
UseSelectReturn<T>

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
hideMode'display-none'
HideMode

How to hide content when mounted but not present. - `'display-none'`: HTML `hidden` attribute. Effects stay alive. - `'activity'`: React 19 `<Activity mode="hidden">`. Effects pause. Requires React 19+.

immediate
boolean

Whether to synchronize the present change immediately or defer it to the next frame

lazyMountfalse
boolean

Whether to enable lazy mounting

onEnterComplete
VoidFunction

Function called when the animation ends in the open state

onExitComplete
VoidFunction

Function called when the animation ends in the closed state

present
boolean

Whether the node is present (controlled by the user)

render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<SelectRootProviderState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

skipAnimationOnMountfalse
boolean

Whether to allow the initial presence animation.

unmountOnExitfalse
boolean

Whether to unmount on exit.

ScrollArrow

Defines the <div> element.

AttributeDefaultType
placement
'top' | 'bottom'

Where the scroll arrow is placed. - `"top"`: the arrow shown at the top of the popup (scrolls content up) - `"bottom"`: the arrow shown at the bottom of the popup (scrolls content down)

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-scroll-arrow]<uid>
[data-placement]The placement of the scrollarrow
[data-state]"visible" | "hidden"

Status

Defines the <div> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

Trigger

Defines the <button> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<SelectTriggerState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-trigger]<uid>
[data-state]"open" | "closed"
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-readonly]Present when read-only
[data-placement]The placement of the trigger
[data-align-with-trigger]
[data-side]The side of the trigger that the trigger is positioned on
[data-placeholder-shown]Present when placeholder is shown

ValueText

Defines the <span> element.

AttributeDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior. Use `render` when you need the part's state: `render={(props, state) => <MyButton {...props} />}`.

For more details, read our Composition guide.
placeholder
string

Text to display when no value is selected.

render
ReactElement<unknown, string | JSXElementConstructor<any>> | RenderFn<EmptyState>

Render the part as a custom element, combining their props and behavior. Pass an element to have the part's props merged into it, or a function to control the merge yourself and read the part's state.

AttributeDescription
[data-select-value-text]<uid>
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-focus]Present when focused

Context

API

PropertyType
scrollArrowVisibility
"none" | "top" | "bottom" | "both"

Which scroll arrows should be visible based on the content's scroll position. - `"none"`: content fits, no scrolling needed - `"top"`: scrolled past the top (top arrow visible) - `"bottom"`: more content below (bottom arrow visible) - `"both"`: scrolled somewhere in the middle (both arrows visible)

focused
boolean

Whether the select is focused

open
boolean

Whether the select is open

empty
boolean

Whether the select value is empty

highlightedValue
string | null

The value of the highlighted item

highlightedItem
V | null

The highlighted item

setHighlightedValue
(value: string | null) => void

Function to highlight a value, or clear the highlight with `null`

selectedItems
V[]

The selected items

hasSelectedItems
boolean

Whether there's a selected option

value
string[]

The selected item keys

valueAsString
string

The string representation of the selected items

selectValue
(value: string) => void

Function to select a value

selectAll
VoidFunction

Function to select all values

setValue
(value: string[]) => void

Function to set the value of the select

clearValue
(value?: string) => void

Function to clear the value of the select. If a value is provided, it will only clear that value, otherwise, it will clear all values.

focus
VoidFunction

Function to focus on the select input

getItemState
(props: ItemProps) => ItemState

Returns the state of a select item

setOpen
(open: boolean, reason?: OpenChangeReason) => void

Function to open or close the select

collection
ListCollection<V>

Function to toggle the select

reposition
(options?: Partial<PositioningOptions>) => void

Function to set the positioning options of the select

multiple
boolean

Whether the select allows multiple selections

disabled
boolean

Whether the select is disabled

getRootState
() => RootState

Returns the state of the root

getTriggerState
() => TriggerState

Returns the state of the trigger

getContentState
() => ContentState

Returns the state of the content

Accessibility

Complies with the Listbox WAI-ARIA design pattern.

Keyboard Support

KeyDescription
Space
When focus is on trigger, opens the select and focuses the first selected item.
When focus is on the content, selects the highlighted item.
Enter
When focus is on trigger, opens the select and focuses the first selected item.
When focus is on content, selects the focused item.
ArrowDown
When focus is on trigger, opens the select.
When focus is on content, moves focus to the next item.
ArrowUp
When focus is on trigger, opens the select.
When focus is on content, moves focus to the previous item.
Esc
Closes the select and moves focus to trigger.
Tab
Closes the select and moves focus to the next element after the trigger (Shift+Tab: the one before it).
A-Za-z
When focus is on trigger, selects the item whose label starts with the typed character.
When focus is on the listbox, moves focus to the next item with a label that starts with the typed character.