Use these primitives when SelectField does not fit your layout.
They expose the root, trigger, value, indicator, popover, listbox, and option parts that
SelectField composes.
SelectRoot is the semantic root. It connects the trigger to the label, description, and error
inside it, and normally owns the selection, open state, validation, form state, and size.
SelectTrigger is the button that opens the popover, and it draws the control chrome. It holds a
SelectValue, which shows the selected option, and a SelectIndicator. SelectPopover holds a
SelectListBox, which holds the SelectItem options.
Put placeholder and the selection, open state, validation, form, and size props on SelectRoot.
value and defaultValue take a key, or null for no selection, and onChange receives the same
type. A select has no read-only state.
id, className, and ref on SelectRoot target the root element. triggerId targets the
trigger, and ref on SelectTrigger reaches it.
Pass isPending to SelectTrigger while a change is saving. The trigger keeps focus but can't be
pressed or opened, and can't change the value from the trigger, until pending ends.
Set isInvalid or a validation prop on SelectRoot. The trigger takes a danger border, and
FieldError inside Field shows the message and the error icon. See
Validation.
The label takes textual, non-interactive content only. Place a link or button outside it. To name
the select without a visible label, pass aria-labelledby or aria-label to SelectRoot.
SelectPopoverProps also accepts compatible DOM and ARIA attributes and event handlers for its rendered element.
Name
Type
Default
arrowBoundaryOffset
number
Default: 0
The minimum distance the arrow's edge should be from the edge of the overlay element.
arrowRef
RefObject<Element | null>
Default: —
A ref for the popover arrow element.
boundaryElement
Element
Default: document.body
Element that that serves as the positioning boundary.
containerPadding
number
Default: 12
The placement padding that should be applied between the element and its
surrounding container.
crossOffset
number
Default: 0
The additional offset applied along the cross axis between the element and its
anchor element.
defaultOpen
boolean
Default: —
Whether the overlay is open by default (uncontrolled).
getTargetRect
(target: Element) => DOMRect| null| undefined
Default: target.getBoundingClientRect()
Overrides the target element's bounding rectangle. Useful for positioning relative to
a specific point such as the mouse cursor (e.g. context menus) or text selection.
Parameters
target
The target element.
isEntering
boolean
Default: —
Whether the popover is currently performing an entry animation.
isExiting
boolean
Default: —
Whether the popover is currently performing an exit animation.
isKeyboardDismissDisabled
boolean
Default: false
Whether pressing the escape key to close the popover should be disabled.
Most popovers should not use this option. When set to true, an alternative
way to close the popover with a keyboard must be provided.
isNonModal
boolean
Default: —
Whether the popover is non-modal, i.e. elements outside the popover may be
interacted with by assistive technologies.
Most popovers should not use this option as it may negatively impact the screen
reader experience. Only use with components such as combobox, which are designed
to handle this situation carefully.
isOpen
boolean
Default: —
Whether the overlay is open by default (controlled).
maxHeight
number
Default: —
The maxHeight specified for the overlay element.
By default, it will take all space up to the current viewport height.
offset
number | undefined
Default: 4
Distance in pixels between the trigger and the popover.
placement
Placement
Default: 'bottom'
The placement of the element with respect to its anchor element.
scrollRef
RefObject<Element | null>
Default: overlayRef
A ref for the scrollable region within the overlay.
shouldCloseOnInteractOutside
(element: Element) => boolean
Default: —
When user interacts with the argument element outside of the popover ref,
return true if onClose should be called. This gives you a chance to filter
out interaction with elements that should not dismiss the popover.
By default, onClose will always be called on interaction outside the popover ref.
shouldFlip
boolean
Default: true
Whether the element should flip its orientation (e.g. top to bottom or left to right) when
there is insufficient room for it to render completely.
shouldSkipAnimation
boolean
Default: —
Whether the popover should appear and disappear without an entry or exit animation. This is
used by components such as PreviewTrigger to skip animations when quickly swapping between
overlays.
shouldUpdatePosition
boolean
Default: true
Whether the overlay should update its position automatically.
trigger
string
Default: —
The name of the component that triggered the popover. This is reflected on the element
as the data-trigger attribute, and can be used to provide specific
styles for the popover depending on which element triggered it.
triggerRef
RefObject<Element | null>
Default: —
The ref for the element which the popover positions itself with respect to.
When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,
this is set automatically. It is only required when used standalone.
SelectListBoxProps also accepts compatible DOM and ARIA attributes and event handlers for its rendered element.
Name
Type
Default
defaultSelectedKeys
'all' | Iterable<Key>
Default: —
The initial selected keys in the collection (uncontrolled).
dependencies
ReadonlyArray<any>
Default: —
Values that should invalidate the item cache when using dynamic collections.
disabledKeys
Iterable<Key>
Default: —
The item keys that are disabled. These items cannot be selected, focused, or otherwise
interacted with.
disallowEmptySelection
boolean
Default: —
Whether the collection allows empty selection.
dragAndDropHooks
DragAndDropHooks<NoInfer<T>>
Default: —
The drag and drop hooks returned by useDragAndDrop used to enable drag and drop behavior for
the ListBox.
escapeKeyBehavior
'clearSelection' | 'none'
Default: 'clearSelection'
Whether pressing the escape key should clear selection in the listbox or not.
Most experiences should not modify this option as it eliminates a keyboard user's ability to
easily clear selection. Only use if the escape key is being handled externally or should not
trigger selection clearing contextually.
items
Iterable<T>
Default: —
Item objects in the collection.
layout
'stack' | 'grid'
Default: 'stack'
Whether the items are arranged in a stack or grid.
orientation
Orientation
Default: 'vertical'
The primary orientation of the items. Usually this is the
direction that the collection scrolls.
renderEmptyState
(props: ListBoxRenderProps) => ReactNode
Default: —
Provides content to display when there are no items in the list.
selectedKeys
'all' | Iterable<Key>
Default: —
The currently selected keys in the collection (controlled).
selectionBehavior
SelectionBehavior
Default: 'toggle'
How multiple selection should behave in the collection.
selectionMode
SelectionMode
Default: —
The type of selection that is allowed in the collection.
shouldFocusOnHover
boolean
Default: —
Whether options should be focused when the user hovers over them.
shouldFocusWrap
boolean
Default: —
Whether focus should wrap around when the end/start is reached.
shouldSelectOnPressUp
boolean
Default: —
Whether selection should occur on press up instead of press down.