# Select

> A field for choosing one or more values from a list.

Source: /docs/components/select

```tsx
import { Select } from '@aksornproject/aksara-ui'
```

## Basic select

`Select` is a namespace of parts. Use it to pick values. To run actions, use [Menu](/docs/components/menu).

`Select.Trigger` draws the 44px field box. `Select.Positioner` places the panel 4px below the trigger with the left edges aligned. `Select.Popup` is the menu panel, at least 280px wide and at least as wide as the trigger. `Select.List` holds the items and scrolls natively.

Pass `items` to `Select.Root` so the trigger can show a label before the list mounts. It takes a record of labels or an array of `value` and `label` entries. A single select can change to `null`.

```tsx
import { Select } from '@aksornproject/aksara-ui'
import { useState } from 'react'

const subjects = [
  { value: 'thai', label: 'Thai' },
  { value: 'maths', label: 'Mathematics' },
  { value: 'science', label: 'Science' },
  { value: 'english', label: 'English' },
  { value: 'social', label: 'Social studies' },
]

export default function SelectBasic() {
  const [subject, setSubject] = useState<string | null>(null)

  return (
    <div className="w-full max-w-[320px]">
      <Select.Root items={subjects} value={subject} onValueChange={setSubject}>
        <Select.Trigger label="Subject" />
        <Select.Portal>
          <Select.Positioner>
            <Select.Popup>
              <Select.List>
                {subjects.map((item) => (
                  <Select.Item key={item.value} value={item.value}>
                    {item.label}
                  </Select.Item>
                ))}
              </Select.List>
            </Select.Popup>
          </Select.Positioner>
        </Select.Portal>
      </Select.Root>
    </div>
  )
}
```

## Variants

`variant` is `input`, the default, or `ghost`. The ghost trigger has no border and no fill until hover. Give a trigger without a `label` an `aria-label`.

```tsx
import { Select, type SelectTriggerVariant } from '@aksornproject/aksara-ui'

const terms = [
  { value: 'term-1', label: 'Term 1' },
  { value: 'term-2', label: 'Term 2' },
]

const VARIANTS: SelectTriggerVariant[] = ['input', 'ghost']

export default function SelectVariants() {
  return (
    <div className="flex w-full max-w-[320px] flex-col gap-spacing-16">
      {VARIANTS.map((variant) => (
        <Select.Root key={variant} items={terms} defaultValue="term-1">
          <Select.Trigger variant={variant} aria-label={`Term, ${variant}`} />
          <Select.Portal>
            <Select.Positioner>
              <Select.Popup>
                <Select.List>
                  {terms.map((item) => (
                    <Select.Item key={item.value} value={item.value}>
                      {item.label}
                    </Select.Item>
                  ))}
                </Select.List>
              </Select.Popup>
            </Select.Positioner>
          </Select.Portal>
        </Select.Root>
      ))}
    </div>
  )
}
```

## Label, description and required

`label` names the field and renders above the trigger. Clicking it focuses the trigger without opening the popup. `description` renders between the label and the trigger. `placeholder` shows while nothing is selected and defaults to "Select...".

Put `required` on `Select.Root`. It turns on native form validation and adds one star to the label.

```tsx
import { Select } from '@aksornproject/aksara-ui'

const grades = [
  { value: 'm1', label: 'Secondary 1' },
  { value: 'm2', label: 'Secondary 2' },
  { value: 'm3', label: 'Secondary 3' },
]

export default function SelectField() {
  return (
    <div className="w-full max-w-[320px]">
      <Select.Root items={grades} name="grade" required>
        <Select.Trigger
          label="Grade"
          description="Students see homework for this grade only"
          placeholder="Choose a grade"
        />
        <Select.Portal>
          <Select.Positioner>
            <Select.Popup>
              <Select.List>
                {grades.map((item) => (
                  <Select.Item key={item.value} value={item.value}>
                    {item.label}
                  </Select.Item>
                ))}
              </Select.List>
            </Select.Popup>
          </Select.Positioner>
        </Select.Portal>
      </Select.Root>
    </div>
  )
}
```

## Status

`status` is `error`, `warning` or `success`. It colours the border and the `message` under the trigger. Only `error` sets `aria-invalid`. Disabled, read-only and loading triggers ignore the status border.

```tsx
import { Select, type SelectStatus } from '@aksornproject/aksara-ui'

const rooms = [
  { value: 'lab-1', label: 'Science lab 1' },
  { value: 'lab-2', label: 'Science lab 2' },
  { value: 'hall', label: 'Main hall' },
]

const FIELDS: { status: SelectStatus; label: string; message: string }[] = [
  { status: 'error', label: 'Room', message: 'Choose a room' },
  { status: 'warning', label: 'Backup room', message: 'Booked on Friday' },
  { status: 'success', label: 'Exam room', message: 'Saved' },
]

export default function SelectStatuses() {
  return (
    <div className="flex w-full max-w-[320px] flex-col gap-spacing-16">
      {FIELDS.map(({ status, label, message }) => (
        <Select.Root key={status} items={rooms}>
          <Select.Trigger status={status} label={label} message={message} />
          <Select.Portal>
            <Select.Positioner>
              <Select.Popup>
                <Select.List>
                  {rooms.map((item) => (
                    <Select.Item key={item.value} value={item.value}>
                      {item.label}
                    </Select.Item>
                  ))}
                </Select.List>
              </Select.Popup>
            </Select.Positioner>
          </Select.Portal>
        </Select.Root>
      ))}
    </div>
  )
}
```

## Disabled, read only and loading

`disabled` and `readOnly` belong on `Select.Root`. A read-only trigger keeps its value readable and hides the chevron. Its popup still opens for browsing, but the value cannot change.

`loading` shows a skeleton bar in place of the value, the chevron and the message. The trigger stays focusable, the popup does not open and the value cannot change.

```tsx
import { Select } from '@aksornproject/aksara-ui'

const years = [
  { value: '2025', label: '2025' },
  { value: '2026', label: '2026' },
]

function Year({
  label,
  ...root
}: {
  label: string
  disabled?: boolean
  readOnly?: boolean
  loading?: boolean
}) {
  return (
    <Select.Root items={years} defaultValue="2026" {...root}>
      <Select.Trigger label={label} />
      <Select.Portal>
        <Select.Positioner>
          <Select.Popup>
            <Select.List>
              {years.map((item) => (
                <Select.Item key={item.value} value={item.value}>
                  {item.label}
                </Select.Item>
              ))}
            </Select.List>
          </Select.Popup>
        </Select.Positioner>
      </Select.Portal>
    </Select.Root>
  )
}

export default function SelectStates() {
  return (
    <div className="flex w-full max-w-[320px] flex-col gap-spacing-16">
      <Year label="Disabled" disabled />
      <Year label="Read only" readOnly />
      <Year label="Loading" loading />
    </div>
  )
}
```

## Multiple values

`multiple` on `Select.Root` makes the value an array and keeps the popup open after each toggle. The trigger shows the selected labels joined with commas on one line and truncates them.

A function child of `Select.Value` formats the value instead, for example as a count. It runs only when something is selected. Pass the `Select.Value` as the trigger's children. The chevron stays.

```tsx
import { Select } from '@aksornproject/aksara-ui'
import { useState } from 'react'

const subjects = [
  { value: 'thai', label: 'Thai' },
  { value: 'maths', label: 'Mathematics' },
  { value: 'science', label: 'Science' },
  { value: 'english', label: 'English' },
  { value: 'social', label: 'Social studies' },
]

export default function SelectMultiple() {
  const [picked, setPicked] = useState<string[]>(['thai', 'english'])

  return (
    <div className="flex w-full max-w-[320px] flex-col gap-spacing-16">
      {[false, true].map((count) => (
        <Select.Root
          key={String(count)}
          items={subjects}
          multiple
          value={picked}
          onValueChange={setPicked}
        >
          <Select.Trigger label={count ? 'Subjects, as a count' : 'Subjects'}>
            {count ? (
              <Select.Value placeholder="Select...">
                {(selected: string[]) => `${selected.length} selected`}
              </Select.Value>
            ) : undefined}
          </Select.Trigger>
          <Select.Portal>
            <Select.Positioner>
              <Select.Popup>
                <Select.List>
                  {subjects.map((item) => (
                    <Select.Item key={item.value} value={item.value}>
                      {item.label}
                    </Select.Item>
                  ))}
                </Select.List>
              </Select.Popup>
            </Select.Positioner>
          </Select.Portal>
        </Select.Root>
      ))}
    </div>
  )
}
```

## Search

`Select.Search` adds a search row above the list. It does not filter automatically. Track the query in your app and apply `hidden` to items that do not match. Keep all items mounted so filtering does not remove a selected value from an uncontrolled multiple select.

Text keys stay in the search field and do not run typeahead. Arrow keys move into the list. The clear button empties the query, never the selection.

```tsx
import { Select } from '@aksornproject/aksara-ui'
import { useState } from 'react'

const students = [
  { value: 'anan', label: 'Anan Srisuk' },
  { value: 'busaba', label: 'Busaba Chaiyo' },
  { value: 'chanida', label: 'Chanida Thongdee' },
  { value: 'dao', label: 'Dao Ruangrit' },
  { value: 'ekachai', label: 'Ekachai Boonma' },
  { value: 'fah', label: 'Fah Kittisak' },
]

export default function SelectSearch() {
  const [query, setQuery] = useState('')
  const [picked, setPicked] = useState<string[]>([])

  return (
    <div className="w-full max-w-[320px]">
      <Select.Root
        items={students}
        multiple
        value={picked}
        onValueChange={setPicked}
      >
        <Select.Trigger label="Students" />
        <Select.Portal>
          <Select.Positioner>
            <Select.Popup>
              <Select.Search value={query} onValueChange={setQuery} />
              <Select.List>
                {students.map((item) => (
                  <Select.Item
                    key={item.value}
                    value={item.value}
                    hidden={
                      !item.label.toLowerCase().includes(query.toLowerCase())
                    }
                  >
                    {item.label}
                  </Select.Item>
                ))}
              </Select.List>
            </Select.Popup>
          </Select.Positioner>
        </Select.Portal>
      </Select.Root>
    </div>
  )
}
```

## Groups and scrolling

Put a `Select.GroupLabel` first inside each `Select.Group`. `Select.Separator` draws a rule between items. `maxHeight` on `Select.List` caps the list, in px or any CSS length, and it scrolls past that. Without it, the list grows to the space the viewport has.

```tsx
import { Select } from '@aksornproject/aksara-ui'

const core = [
  { value: 'thai', label: 'Thai' },
  { value: 'maths', label: 'Mathematics' },
  { value: 'science', label: 'Science' },
  { value: 'english', label: 'English' },
]

const electives = [
  { value: 'art', label: 'Art' },
  { value: 'music', label: 'Music' },
  { value: 'computing', label: 'Computing' },
  { value: 'health', label: 'Health' },
]

export default function SelectGroups() {
  return (
    <div className="w-full max-w-[320px]">
      <Select.Root items={[...core, ...electives]}>
        <Select.Trigger label="Subject" />
        <Select.Portal>
          <Select.Positioner>
            <Select.Popup>
              <Select.List maxHeight={240}>
                <Select.Group>
                  <Select.GroupLabel>Core</Select.GroupLabel>
                  {core.map((item) => (
                    <Select.Item key={item.value} value={item.value}>
                      {item.label}
                    </Select.Item>
                  ))}
                </Select.Group>
                <Select.Separator />
                <Select.Group>
                  <Select.GroupLabel>Electives</Select.GroupLabel>
                  {electives.map((item) => (
                    <Select.Item key={item.value} value={item.value}>
                      {item.label}
                    </Select.Item>
                  ))}
                </Select.Group>
              </Select.List>
            </Select.Popup>
          </Select.Positioner>
        </Select.Portal>
      </Select.Root>
    </div>
  )
}
```

## Accessibility

- The trigger is a native button with `role="combobox"`. The `label` names it.
- `description` and `message` are linked with `aria-describedby`. `status="error"` sets `aria-invalid`.
- `required` on `Select.Root` sets `aria-required`. The star on the label is `aria-hidden`.
- Arrow keys, Home, End and typeahead move between options. Enter and Space pick, and Escape closes.
- `Select.Search` is named "Search" and its clear button stays out of the tab order and the accessibility tree.

## API

### Select.Root

`Select.Root` takes the Base UI Select Root props and adds `loading`. It is generic over the value type and `multiple`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  |  |
| `inputRef` | `React.Ref<HTMLInputElement>` |  | A ref to access the hidden input element. |
| `name` | `string` |  | Identifies the field when a form is submitted. |
| `form` | `string` |  | Identifies the form that owns the hidden input. Useful when the select is rendered outside the form. |
| `autoComplete` | `string` |  | Provides a hint to the browser for autofill. |
| `id` | `string` |  | The id of the Select. |
| `required` | `boolean` | `false` | Whether the user must choose a value before submitting a form. |
| `readOnly` | `boolean` | `false` | Whether the user should be unable to choose a different option from the select popup. |
| `disabled` | `boolean` | `false` | Whether the component should ignore user interaction. |
| `multiple` | `Multiple` | `false` | Whether multiple items can be selected. |
| `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. |
| `defaultOpen` | `boolean` | `false` | Whether the select popup is initially open. To render a controlled select popup, use the `open` prop instead. |
| `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. |
| `open` | `boolean` |  | Whether the select popup is currently open. |
| `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. |
| `actionsRef` | `React.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. |
| `items` | `readonly Group<any>[] \| readonly { label: React.ReactNode; value: any; }[] \| Record<string, ReactNode>` |  | 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. |
| `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. |
| `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. |
| `value` | `SelectInputValue<Value, Multiple> \| null` |  | The value of the select. Use when controlled. |
| `onValueChange` | `((value: SelectOutputValue<Value, Multiple> \| (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails) => void)` |  | Event handler called when the value of the select changes. |
| `loading` | `boolean` |  | Shows the skeleton bar in the trigger. The popup does not open and the value cannot change. The trigger stays focusable. |

### Select.Trigger

The ref and `className` reach the trigger button, not the field around it. `Select.Trigger` has no `render`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `style` | `React.CSSProperties \| ((state: SelectTriggerState) => React.CSSProperties \| undefined)` |  | Style applied to the element, or a function that returns a style object based on the component's state. |
| `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>`). |
| `disabled` | `boolean` |  | Whether the component should ignore user interaction. |
| `className` | `string` |  | Classes for the part. Styled parts merge them last with `cn()`. |
| `variant` | `"ghost" \| "input"` |  | Defaults to `'input'`. |
| `status` | `"error" \| "success" \| "warning"` |  | Colours the border, sets `aria-invalid` for `'error'` and tones the message. |
| `label` | `ReactNode` |  | Rendered above the trigger in a `Select.Label`. Clicking it focuses the trigger. |
| `description` | `ReactNode` |  | Rendered between the label and the trigger and linked with `aria-describedby`. |
| `message` | `ReactNode` |  | Rendered under the trigger, toned by `status` and linked with `aria-describedby`. |
| `placeholder` | `ReactNode` |  | Shown while nothing is selected. Defaults to `'Select...'`. |
| `children` | `ReactNode` |  | Replaces the default `Select.Value`, for example to put text before the value. The chevron and the loading bar stay. |

### Select.Value

| Prop | Type | Description |
| --- | --- | --- |
| `render` | `ComponentRenderFn<HTMLProps, SelectValueState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectValueState) => React.CSSProperties \| undefined)` | Style applied to the element, or a function that returns a style object based on the component's state. |
| `children` | `((value: any) => React.ReactNode) \| 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` | `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`. |
| `className` | `string` | Classes for the part. Styled parts merge them last with `cn()`. |

### Select.Icon

| Prop | Type | Description |
| --- | --- | --- |
| `render` | `ComponentRenderFn<HTMLProps, SelectIconState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectIconState) => React.CSSProperties \| undefined)` | Style applied to the element, or a function that returns a style object based on the component's state. |
| `className` | `string` | Classes for the part. Styled parts merge them last with `cn()`. |

### Select.Portal

| Prop | Type | Description |
| --- | --- | --- |
| `className` | `string \| ((state: SelectPortalState) => string \| undefined)` | CSS class applied to the element, or a function that returns a class based on the component's state. |
| `render` | `ComponentRenderFn<HTMLProps, SelectPortalState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectPortalState) => React.CSSProperties \| undefined)` | Style applied to the element, or a function that returns a style object based on the component's state. |
| `container` | `HTMLElement \| React.RefObject<HTMLElement \| ShadowRoot \| null> \| ShadowRoot \| null` | A parent element to render the portal element into. |

### Select.Positioner

`side` defaults to `bottom`, `align` to `start`, `sideOffset` to 4 and `alignItemWithTrigger` to `false`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string \| ((state: SelectPositionerState) => string \| undefined)` |  | CSS class applied to the element, or a function that returns a class based on the component's state. |
| `render` | `ComponentRenderFn<HTMLProps, SelectPositionerState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectPositionerState) => React.CSSProperties \| undefined)` |  | Style applied to the element, or a function that returns a style object based on the component's state. |
| `anchor` | `Element \| React.RefObject<Element \| null> \| VirtualElement \| (() => Element \| VirtualElement \| null) \| null` |  | An element to position the popup against. By default, the popup will be positioned against the trigger. |
| `positionMethod` | `"absolute" \| "fixed"` | `'absolute'` | Determines which CSS `position` property to use. |
| `side` | `"bottom" \| "inline-end" \| "inline-start" \| "left" \| "right" \| "top"` | `'bottom'` | Which side of the anchor element to align the popup against. May automatically change to avoid collisions. |
| `sideOffset` | `number \| OffsetFunction` | `0` | Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. |
| `align` | `"center" \| "end" \| "start"` | `'center'` | How to align the popup relative to the specified side. |
| `alignOffset` | `number \| OffsetFunction` | `0` | Additional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. |
| `collisionBoundary` | `Boundary` | `'clipping-ancestors'` | An element or a rectangle that delimits the area that the popup is confined to. |
| `collisionPadding` | `Padding` | `5` | Additional space to maintain from the edge of the collision boundary. |
| `sticky` | `boolean` | `false` | Whether to maintain the popup in the viewport after the anchor element was scrolled out of view. |
| `arrowPadding` | `number` | `5` | Minimum distance to maintain between the arrow and the edges of the popup. Use it to prevent the arrow element from hanging out of the rounded corners of a popup. |
| `disableAnchorTracking` | `boolean` | `false` | Whether to disable the popup from tracking any layout shift of its positioning anchor. |
| `collisionAvoidance` | `CollisionAvoidance` |  | Determines how to handle collisions when positioning the popup. `side` controls overflow on the preferred placement axis (`top`/`bottom` or `left`/`right`): - `'flip'`: keep the requested side when it fits; otherwise try the opposite side (`top` and `bottom`, or `left` and `right`). - `'shift'`: never change side; keep the requested side and move the popup within the clipping boundary so it stays visible. - `'none'`: do not correct side-axis overflow. `align` controls overflow on the alignment axis (`start`/`center`/`end`): - `'flip'`: keep side, but swap `start` and `end` when the requested alignment overflows. - `'shift'`: keep side and requested alignment, then nudge the popup along the alignment axis to fit. - `'none'`: do not correct alignment-axis overflow. `fallbackAxisSide` controls fallback behavior on the perpendicular axis when the preferred axis cannot fit: - `'start'`: allow perpendicular fallback and try the logical start side first (`top` before `bottom`, or `left` before `right` in LTR). - `'end'`: allow perpendicular fallback and try the logical end side first (`bottom` before `top`, or `right` before `left` in LTR). - `'none'`: do not fallback to the perpendicular axis. When `side` is `'shift'`, explicitly setting `align` only supports `'shift'` or `'none'`. If `align` is omitted, it defaults to `'flip'`. |
| `alignItemWithTrigger` | `boolean` | `true` | Whether the positioner overlaps the trigger so the selected item's text is aligned with the trigger's value text. This only applies to mouse input and is automatically disabled if there is not enough space. |

### Select.Popup

| Prop | Type | Description |
| --- | --- | --- |
| `render` | `ComponentRenderFn<HTMLProps, SelectPopupState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectPopupState) => React.CSSProperties \| undefined)` | Style applied to the element, or a function that returns a style object based on the component's state. |
| `children` | `ReactNode` |  |
| `finalFocus` | `boolean \| React.RefObject<HTMLElement \| null> \| ((closeType: InteractionType) => boolean \| HTMLElement \| null \| void)` | 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. |
| `className` | `string` | Classes for the part. Styled parts merge them last with `cn()`. |

### Select.List

| Prop | Type | Description |
| --- | --- | --- |
| `render` | `ComponentRenderFn<HTMLProps, SelectListState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectListState) => React.CSSProperties \| undefined)` | Style applied to the element, or a function that returns a style object based on the component's state. |
| `className` | `string` | Classes for the part. Styled parts merge them last with `cn()`. |
| `maxHeight` | `string \| number` | The tallest the list grows before it scrolls, in px or any CSS length. Unset, the list grows to the space the viewport has. |

### Select.Item

A selected item gets the selection fill and the end tick.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `render` | `ComponentRenderFn<HTMLProps, SelectItemState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectItemState) => React.CSSProperties \| undefined)` |  | Style applied to the element, or a function that returns a style object based on the component's state. |
| `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. |
| `disabled` | `boolean` | `false` | 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. |
| `className` | `string` |  | Classes for the part. Styled parts merge them last with `cn()`. |
| `children` | `ReactNode` |  | The label. It wraps and the row grows. |

### Select.ItemText

| Prop | Type | Description |
| --- | --- | --- |
| `render` | `ComponentRenderFn<HTMLProps, SelectItemTextState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectItemTextState) => React.CSSProperties \| undefined)` | Style applied to the element, or a function that returns a style object based on the component's state. |
| `className` | `string` | Classes for the part. Styled parts merge them last with `cn()`. |

### Select.ItemIndicator

| Prop | Type | Description |
| --- | --- | --- |
| `render` | `ComponentRenderFn<HTMLProps, SelectItemIndicatorState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectItemIndicatorState) => React.CSSProperties \| undefined)` | Style applied to the element, or a function that returns a style object based on the component's state. |
| `children` | `ReactNode` |  |
| `keepMounted` | `boolean` | Whether to keep the HTML element in the DOM when the item is not selected. |
| `className` | `string` | Classes for the part. Styled parts merge them last with `cn()`. |

### Select.Group

| Prop | Type | Description |
| --- | --- | --- |
| `className` | `string \| ((state: SelectGroupState) => string \| undefined)` | CSS class applied to the element, or a function that returns a class based on the component's state. |
| `render` | `ComponentRenderFn<HTMLProps, SelectGroupState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectGroupState) => React.CSSProperties \| undefined)` | Style applied to the element, or a function that returns a style object based on the component's state. |

### Select.GroupLabel

| Prop | Type | Description |
| --- | --- | --- |
| `render` | `ComponentRenderFn<HTMLProps, SelectGroupLabelState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectGroupLabelState) => React.CSSProperties \| undefined)` | Style applied to the element, or a function that returns a style object based on the component's state. |
| `className` | `string` | Classes for the part. Styled parts merge them last with `cn()`. |

### Select.Separator

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `render` | `ComponentRenderFn<HTMLProps, SelectSeparatorState> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
| `style` | `React.CSSProperties \| ((state: SelectSeparatorState) => React.CSSProperties \| undefined)` |  | Style applied to the element, or a function that returns a style object based on the component's state. |
| `orientation` | `"horizontal" \| "vertical"` | `'horizontal'` | The orientation of the separator. |
| `className` | `string` |  | Classes for the part. Styled parts merge them last with `cn()`. |

### Select.Search

The ref and `className` reach the input.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `placeholder` | `string` |  | Defaults to `'Search...'`. |
| `className` | `string` |  | Classes for the part. Styled parts merge them last with `cn()`. |
| `value` | `string` |  | The query, for a controlled field. |
| `defaultValue` | `string` | `''` | The starting query of an uncontrolled field. |
| `onValueChange` | `((value: string) => void)` |  | Called with the new query on each edit and when the clear button empties it. |