XiodUI
HomeDocs
OverviewComponentsStyling & CustomizationChangelog

Components

  • Accordion
  • Agent Steps
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Autocomplete
  • Avatar
  • Badge
  • Breadcrumb
  • Button
  • Button Group
  • Button Split
  • Calendar
  • Card
  • Carousel
  • Checkbox
  • Circular Progress
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy To Clipboard
  • Corner Badge
  • Dashboard Grid
  • Date Picker
  • Dialog
  • Dot Matrix
  • Draggable
    Updated
  • Drawer
  • Empty
  • Field
  • Fieldset
  • File Upload
    Updated
  • Form
  • Frame
  • Gauge
  • Grid
  • Group
  • Input
  • Input Group
  • Input OTP
  • Input Payment
  • Input Phone
    Updated
  • Input Sensitive
  • Kbd
  • Kinetic Click
  • Label
  • List Box
    Updated
  • Loader
  • Marker
  • Menu
  • Menubar
  • Message
  • Meter
  • Morphic Toast
  • Navigation Menu
  • Number Field
  • Option Picker
  • Orb
  • Pagination
  • Popover
  • Preview Card
    Updated
  • Progress
  • Radio
  • Resizable
  • Ruler Picker
  • Scroll Area
  • Scroll Bar
  • Select
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Sortable
  • Switch
  • Table
  • Tabs
  • Text
  • Textarea
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Toolbar
  • Tooltip
  • Waveform
  • Wheel Picker

Loading...

Preview Skeleton

Installation Skeleton

Usage Skeleton

API Reference Skeleton

Sponsors

Support the development of XiodUI and help us build the best component library on Earth.

+++
Sponsor on GitHub

Select

Previous: Scroll BarNext: Separator

A button that opens a list of options to choose from.

Preview

Loading Preview...

Installation

bun add xiod-ui

Usage

Imports

1import {2  Select,3  SelectButton,4  SelectGroup,5  SelectGroupLabel,6  SelectItem,7  SelectPopup,8  SelectSeparator,9  SelectTrigger,10  SelectValue11} from "xiod-ui/select";

Anatomy

1<Select>2  <SelectTrigger>3    <SelectValue />4  </SelectTrigger>5  <SelectPopup>6    <SelectItem />7  </SelectPopup>8</Select>

API Reference

Detailed documentation of properties and options.

Select

PropTypeDefaultDescription
actionsRef
RefObject<SelectRootActions | null>
–

A ref to imperative actions.

  • unmount: Ends the closing phase of the select after an externally controlled closing animation finishes.

Call preventUnmountOnClose() in onOpenChange first, otherwise the select completes closing on its own. Whether it leaves the DOM is decided by keepMounted on the portal.

  • close: Closes the select imperatively when called.
autoComplete

SelectButton

Accepts render, plus every native attribute of the element it renders.

PropTypeDefaultDescription
icon
ReactNode
–

Replaces this icon. Accepts any node; null renders no icon. Takes precedence over IconProvider.

size
"lg"|"sm"

SelectGroup

Accepts className, style and render, plus every native attribute of the element it renders.

SelectGroupLabel

Accepts className, style and render, plus every native attribute of the element it renders.

SelectItem

Accepts className, style and render, plus every native attribute of the element it renders.

PropTypeDefaultDescription
children
ReactNode
–

The content of the component.

disabled
boolean
false

SelectPopup

Accepts className, style and render, plus every native attribute of the element it renders.

PropTypeDefaultDescription
align
"center"|"start"|"end"
start

How the calendar lines up with the trigger along that side.

alignItemWithTrigger

SelectSeparator

Accepts className, style and render, plus every native attribute of the element it renders.

PropTypeDefaultDescription
orientation
"horizontal"|"vertical"
'horizontal'

The orientation of the separator.

SelectTrigger

Accepts className, style and render, plus every native attribute of the element it renders.

PropTypeDefaultDescription
children
ReactNode
–

The content of the component.

disabled
boolean
–

SelectValue

Accepts className, style and render, plus every native attribute of the element it renders.

PropTypeDefaultDescription
children
ReactNode | ((value: any) => ReactNode)
–

Accepts a function that returns a ReactNode to format the selected value. Treat the value as read-only: in multiple mode it may be a shared frozen array when nothing is selected.

placeholder
Scroll BarSeparator
string
–

Provides a hint to the browser for autofill.

children
ReactNode
–

The content of the component.

defaultOpen
boolean
false

Whether the select popup is initially open.

To render a controlled select popup, use the open prop instead.

defaultValue
SelectInputValue<Value, Multiple> | null
–

The uncontrolled value of the select when it's initially rendered.

To render a controlled select, use the value prop instead.

disabled
boolean
false

Whether the component should ignore user interaction.

form
string
–

Identifies the form that owns the hidden input. Useful when the select is rendered outside the form.

highlightItemOnHover
boolean
true

Whether moving the pointer over items should highlight them. Disabling this prop allows CSS :hover to be differentiated from the :focus (data-highlighted) state.

id
string
–

The id of the Select.

inputRef
Ref<HTMLInputElement>
–

A ref to access the hidden input element.

isItemEqualToValue
((itemValue: Value, value: Value) => boolean)
–

Custom comparison logic used to determine if a select item value matches the current selected value. Useful when item values are objects without matching referentially. Defaults to Object.is comparison.

items
readonly Group<any>[] | Record<string, ReactNode> | readonly { label: ReactNode; value: any; }[]
–

Data structure of the items rendered in the select popup. When specified, <Select.Value> renders the label of the selected item instead of the raw value.

itemToStringLabel
((itemValue: Value) => string)
–

When the item values are objects (<Select.Item value={object}>), this function converts the object value to a string representation for display in the trigger. If the shape of the object is { value, label }, the label will be used automatically without needing to specify this prop.

itemToStringValue
((itemValue: Value) => string)
–

When the item values are objects (<Select.Item value={object}>), this function converts the object value to a string representation for form submission. If the shape of the object is { value, label }, the value will be used automatically without needing to specify this prop.

modal
boolean
true

Determines if the select enters a modal state when open.

  • true: user interaction is limited to the select: document page scroll is locked and pointer interactions on outside elements are disabled.
  • false: user interaction with the rest of the document is allowed.

On touch devices, a true modal blocks outside taps but leaves the page scrollable unless the popup spans nearly the full viewport width, matching native iOS behavior.

multiple
Multiple
false

Whether multiple items can be selected.

name
string
–

Identifies the field when a form is submitted.

onOpenChange
((open: boolean, eventDetails: SelectRootOpenChangeEventDetails) => void)
–

Event handler called when the select popup is opened or closed.

onOpenChangeComplete
((open: boolean) => void)
–

Event handler called after any animations complete when the select popup is opened or closed.

onValueChange
((value: SelectOutputValue<Value, Multiple> | (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails) => void)
–

Event handler called when the value of the select changes.

open
boolean
–

Whether the select popup is currently open.

readOnly
boolean
false

Whether the user should be unable to choose a different option from the select popup.

required
boolean
false

Whether the user must choose a value before submitting a form.

value
SelectInputValue<Value, Multiple> | null
–

The value of the select. Use when controlled.

|"default"
default

The size of the component.

Whether the component should ignore user interaction.

label
string
–

Specifies the text label to use when the item is matched during keyboard text navigation.

Defaults to the item text content if not provided.

nativeButton
boolean
false

Whether the component renders a native <button> element when replacing it via the render prop. Set to true if the rendered element is a native button.

value
any
null

A unique value that identifies this select item.

boolean
true

Whether the popup opens with the selected item placed over the trigger, like a native select. When false, the popup opens beside the trigger.

alignOffset
number|OffsetFunction
0

Additional offset along the alignment axis, in pixels.

anchor
Select$1.Positioner.Props["anchor"]
–

An element to position the popup against. Defaults to the trigger.

children
ReactNode
–

The content of the component.

finalFocus
boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | void | HTMLElement | null)
–

Determines the element to focus when the select popup is closed.

  • false: Do not move focus.
  • true: Move focus based on the default behavior (trigger or previously focused element).
  • RefObject: Move focus to the ref element.
  • function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, or false/undefined to do nothing.
scrollDownIcon
ReactNode
–

Replaces this icon. Accepts any node; null renders no icon. Takes precedence over IconProvider.

scrollUpIcon
ReactNode
–

Replaces this icon. Accepts any node; null renders no icon. Takes precedence over IconProvider.

side
"top"|"bottom"|"left"|"right"|"inline-end"|"inline-start"
bottom

Which side of the copy button the tooltip and toast open on.

sideOffset
number|OffsetFunction
4

The gap between the trigger and the calendar, in pixels.

Whether the component should ignore user interaction.

icon
ReactNode
–

Replaces this icon. Accepts any node; null renders no icon. Takes precedence over IconProvider.

nativeButton
boolean
true

Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>).

size
"lg"|"sm"|"default"
default

The size of the component.

ReactNode
–

The placeholder value to display when no value is selected. This is overridden by children if specified, or by a null item's label in items.