Select

Select lets users choose one value from a dropdown.

tsx
import { Select } from '@/components/ui/wideset/select/Select';

<Select
  options={[
    { value: 'design', label: 'Design' },
    { value: 'engineering', label: 'Engineering' },
    { value: 'marketing', label: 'Marketing' },
    { value: 'support', label: 'Customer support' },
  ]}
  defaultValue="engineering"
  placeholder="Choose a team"
  aria-label="Team"
/>

Installation

pnpm dlx wideset add select

Copies the component and any Wideset components it uses into your project.

Examples

Variants

Primary is the default. Danger marks a choice that failed validation, such as a required field left empty on submit; put the reason in the FormField's errorText, which the field links to the control with aria-describedby, because the red border alone does not reach screen reader users.

tsx
import { Select } from '@/components/ui/wideset/select/Select';

const TEAMS = [
  { value: 'design', label: 'Design' },
  { value: 'engineering', label: 'Engineering' },
  { value: 'marketing', label: 'Marketing' },
];

export default function SelectVariants() {
  return (
    <div className="gap-ws-12 flex w-[16rem] max-w-full flex-col">
      {(['primary', 'danger'] as const).map((variant) => (
        <Select
          key={variant}
          variant={variant}
          options={TEAMS}
          placeholder="Choose a team"
          aria-label="Team"
        />
      ))}
    </div>
  );
}

Presets

Border is the default, for a select in a form or on the page. Ghost drops the frame and reads as a value: its arrow and a soft background show on hover, keyboard focus or while open. Use it for a select inside a surface that already has one, such as a toolbar, a card header or a table cell.

tsx
import { Select } from '@/components/ui/wideset/select/Select';

const TEAMS = [
  { value: 'design', label: 'Design' },
  { value: 'engineering', label: 'Engineering' },
  { value: 'marketing', label: 'Marketing' },
];

export default function SelectPresets() {
  return (
    <div className="gap-ws-12 flex w-[16rem] max-w-full flex-col">
      {(['border', 'ghost'] as const).map((preset) => (
        <Select
          key={preset}
          preset={preset}
          options={TEAMS}
          defaultValue="engineering"
          aria-label="Team"
        />
      ))}
    </div>
  );
}

Sizes

Medium is the default for forms. Small fits filter bars and dense tables, large a short form that is the main task on the page. Match the size of the fields and buttons next to the select.

tsx
import { Select } from '@/components/ui/wideset/select/Select';

const TEAMS = [
  { value: 'design', label: 'Design' },
  { value: 'engineering', label: 'Engineering' },
  { value: 'marketing', label: 'Marketing' },
];

export default function SelectSizes() {
  return (
    <div className="gap-ws-12 flex w-[16rem] max-w-full flex-col">
      {(['sm', 'md', 'lg'] as const).map((size) => (
        <Select
          key={size}
          size={size}
          options={TEAMS}
          placeholder="Choose a team"
          aria-label="Team"
        />
      ))}
    </div>
  );
}

States

The placeholder shows until a value is chosen; with clearable a clear button appears once one is, and it empties the value without opening the list. A disabled select is skipped by Tab and shows no clear button.

tsx
import { Select } from '@/components/ui/wideset/select/Select';

const TEAMS = [
  { value: 'design', label: 'Design' },
  { value: 'engineering', label: 'Engineering' },
  { value: 'marketing', label: 'Marketing' },
];

export default function SelectStates() {
  return (
    <div className="gap-x-ws-7 gap-y-ws-5 grid grid-cols-[6rem_16rem] items-center">
      <span className="typography-caption-md text-ws-static-subtle">Placeholder</span>
      <Select options={TEAMS} placeholder="Choose a team" aria-label="Team" />
      <span className="typography-caption-md text-ws-static-subtle">Chosen</span>
      <Select options={TEAMS} defaultValue="engineering" aria-label="Team" clearable />
      <span className="typography-caption-md text-ws-static-subtle">Disabled</span>
      <Select options={TEAMS} defaultValue="engineering" aria-label="Team" disabled />
    </div>
  );
}

API reference

Select

NameDescriptionDefault
children

Sub-components for composable usage (`Select.Trigger`, `Select.Content`, `Select.Option`, etc.). Use instead of `options` when you need grouped options, custom layouts, or full rendering control.

ReactNode
—
className

Additional CSS classes applied to the trigger element. Width utilities (e.g. `w-[20rem]`) override the default width.

string
—
clearable

Whether to show a clear button in the trigger when a value is selected.

boolean
—
clearSelectionAriaLabel

Accessible label for the clear-selection button. Defaults to `'Clear selection'`.

string
'Clear selection'
defaultMotion

Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`.

boolean
true
hasSearch

Whether to show a search input at the top of the dropdown that filters options by label.

boolean
false
hideArrow

Whether to hide the dropdown arrow icon on the right side of the trigger.

boolean
—
id

HTML `id` attribute for the trigger element, useful for form label association.

string
—
name

HTML `name` attribute forwarded for form submission.

string
—
onClear

Called when the clear button is clicked. Use for custom reset logic beyond clearing the value.

(() => void)
—
options

Array of options to display in the dropdown. Each item requires `value` and `label`.

SelectOptionType<Record<string, unknown>>[]
—
placeholder

Placeholder text shown in the trigger when no option is selected.

string
—
preset

Visual style preset. `border` adds a visible border and background; `ghost` uses a transparent background.

'border''ghost'
—
size

Controls the height, padding, and typography size of the trigger.

'sm''md''lg'
—
variant

Color variant. `danger` applies error styling for form validation feedback.

'primary''danger'
'primary'
Every other prop of <button> is passed through to it. See MDN: <button>.

Select.Content

NameDescriptionDefault
defaultMotion

Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`.

boolean
true
portalContainer

DOM node to portal the dropdown content into. Defaults to `document.body`.

Element | DocumentFragment
—
position

Controls how the dropdown is positioned relative to the trigger.

'item-aligned''popper'
'popper'
shouldUsePrimitive

Internal flag — set to `false` to render as a `DropdownMenu.Content` instead of the Radix Select portal (used inside Dropdown).

boolean
true
Every other prop of Radix Select.Content is passed through to it. See Radix Select.Content.

Select.Group

No props of its ownIt takes its content as children.
Every other prop of Radix Select.Group is passed through to it. See Radix Select.Group.

Select.ItemIndicator

No props of its ownIt takes its content as children.
Every other prop of Radix Select.ItemIndicator is passed through to it. See Radix Select.ItemIndicator.

Select.ItemText

No props of its ownIt takes its content as children.
Every other prop of Radix Select.ItemText is passed through to it. See Radix Select.ItemText.

Select.Label

No props of its ownIt takes its content as children.
Every other prop of Radix Select.Label is passed through to it. See Radix Select.Label.

Select.Option

NameDescriptionDefault
defaultMotion

Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`.

boolean
true
disabled

Disables interaction with the control.

boolean
—
shouldDisplayCheckmark

Whether to show a checkmark indicator on the selected option.

boolean
true
shouldUsePrimitive

Internal flag — omit or set to `true` to use the Radix Select item primitive. Internal flag — set to `false` to render as a plain `<div>` (used inside Dropdown).

boolean
true
textValuestring—
valuestring—
variant

Color variant applied to the option row. `danger` renders red text for destructive choices.

'primary''danger'
—

Select.Root

No props of its ownIt takes its content as children.
Every other prop of Radix Select.Root is passed through to it. See Radix Select.Root.

Select.ScrollDownButton

No props of its ownIt takes its content as children.
Every other prop of Radix Select.ScrollDownButton is passed through to it. See Radix Select.ScrollDownButton.

Select.ScrollUpButton

No props of its ownIt takes its content as children.
Every other prop of Radix Select.ScrollUpButton is passed through to it. See Radix Select.ScrollUpButton.

Select.Search

NameDescriptionDefault
className

Additional CSS classes applied to the search wrapper.

string
—
onChange

Called when the search input value changes.

ChangeEventHandler<HTMLInputElement, Element>
—
onClear

Called when the clear button inside the search input is clicked.

(() => void)
—
value

Current search query value for controlled usage.

string
—
Every other prop of <input> is passed through to it. See MDN: <input>.

Select.Separator

No props of its ownIt takes its content as children.
Every other prop of Radix Select.Separator is passed through to it. See Radix Select.Separator.

Select.Trigger

NameDescriptionDefault
defaultMotion

Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`.

boolean
true
hideArrow

Whether to hide the dropdown arrow icon on the right side of the trigger.

boolean
—
id

HTML `id` attribute forwarded to the trigger element for form label association.

string
—
name

HTML `name` attribute forwarded for form submission.

string
—
placeholder

Placeholder text shown when no value is selected. Also used as the accessible label fallback.

string
—
preset

Visual style preset. `border` adds a visible border and background; `ghost` uses a transparent background.

'border''ghost'
'border'
shouldUsePrimitive

Internal flag — set to `false` to render a plain `<button>` instead of the Radix Select trigger (used inside Dropdown).

boolean
true
size

Controls the height, padding, and typography size of the trigger.

'sm''md''lg'
'md'
variant

Color variant. `danger` applies error styling for form validation feedback.

'primary''danger'
'primary'
Every other prop of Radix Select.Trigger is passed through to it. See Radix Select.Trigger.

Select.Value

No props of its ownIt takes its content as children.
Every other prop of Radix Select.Value is passed through to it. See Radix Select.Value.

Accessibility

  • Name it: FormField htmlFor + id on Select (it lands on the trigger), or aria-label.
  • Radix gives the listbox roles, typeahead and arrow keys.
  • The clear button is labelled “Clear selection”; translate with clearSelectionAriaLabel.
PartRendersDescription
Select<button>A dropdown selection control for one value.
Select.ContentRadix Select.ContentThe content surface rendered within `Select`.
Select.GroupRadix Select.GroupThe Radix Select group.
Select.ItemIndicatorRadix Select.ItemIndicatorProps for `Select.ItemIndicator`.
Select.ItemTextRadix Select.ItemTextProps for `Select.ItemText`.
Select.LabelRadix Select.LabelThe text label associated with `Select`.
Select.Option—A selectable option within the dropdown.
Select.RootRadix Select.RootProps for the Radix Select root, which holds open and value state and renders no DOM.
Select.ScrollDownButtonRadix Select.ScrollDownButtonButton that scrolls the option list down when it overflows.
Select.ScrollUpButtonRadix Select.ScrollUpButtonButton that scrolls the option list up when it overflows.
Select.Search<input>Search input inside the dropdown for filtering options.
Select.SeparatorRadix Select.SeparatorA visual separator between groups of items.
Select.TriggerRadix Select.TriggerThe control that opens or toggles the associated content.
Select.ValueRadix Select.ValueRenders the selected value inside the trigger.
tsx
import { Select } from '@/components/ui/wideset/select/Select';

<Select
  options={[
    { value: 'design', label: 'Design' },
    { value: 'engineering', label: 'Engineering' },
    { value: 'marketing', label: 'Marketing' },
    { value: 'support', label: 'Customer support' },
  ]}
  defaultValue="engineering"
  placeholder="Choose a team"
  aria-label="Team"
/>

Appearance

Variant
Style
Size
Hide arrow

Content

Value chosen

State

Disabled

Behavior

Clear button
Search in list