Components

Select

Displays a list of options for the user to pick from—triggered by a button.

<Select.Root defaultValue="apple">
<Select.Trigger />
<Select.Content>
<Select.Group>
<Select.Label>Fruits</Select.Label>
<Select.Item value="orange">Orange</Select.Item>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="grape" disabled>
Grape
</Select.Item>
</Select.Group>
<Select.Separator />
<Select.Group>
<Select.Label>Vegetables</Select.Label>
<Select.Item value="carrot">Carrot</Select.Item>
<Select.Item value="potato">Potato</Select.Item>
</Select.Group>
</Select.Content>
</Select.Root>

API Reference

Root

Contains all the parts of a select. It inherits props from the Select.Root primitive part.

PropTypeDefault
size
Responsive<"1" | "2" | "3">
"2"

Trigger

The button that toggles the select. This component inherits props from the Select.Trigger primitive and Select.Value primitive parts. It supports common margin props.

PropTypeDefault
asChild
boolean
false
variant
"classic" | "surface" | "soft" | "ghost"
"surface"
color
enum
No default value
radius
"none" | "small" | "medium" | "large" | "full"
No default value

Content

The component that pops out when the select is open. It inherits props from the Select.Portal primitive and Select.Content primitive parts.

PropTypeDefault
variant
"solid" | "soft"
"solid"
color
enum
No default value
highContrast
boolean
No default value

Item

The component that contains the select items. It inherits props from the Select.Item primitive part.

Group

Used to group multiple items. It inherits props from the Select.Group primitive part. Use in conjunction with Select.Label to ensure good accessibility via automatic labelling.

Label

Used to render the label of a group, it isn't focusable using arrow keys. It inherits props from the Select.Label primitive part.

Separator

Used to visually separate items in the Select. It inherits props from the Select.Separator primitive part.

Examples

Alternative positioning

Set the position prop to popper and use the side prop to position items below the trigger.

<Select.Root defaultValue="apple">
<Select.Trigger />
<Select.Content position="popper">
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>

Size

Use the size prop to control the size.

<Flex gap="3" align="center">
<Select.Root size="1" defaultValue="apple">
<Select.Trigger />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root size="2" defaultValue="apple">
<Select.Trigger />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root size="3" defaultValue="apple">
<Select.Trigger />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
</Flex>

Variant

Use the variant prop on Trigger and Content to customize the visual style.

<Flex gap="3" align="center">
<Select.Root defaultValue="apple">
<Select.Trigger variant="surface" />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root defaultValue="apple">
<Select.Trigger variant="classic" />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root defaultValue="apple">
<Select.Trigger variant="soft" />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
</Flex>

Ghost

Use the ghost trigger variant to render the trigger without a visually containing element. Ghost triggers behave differently in layout as they use a negative margin to optically align themselves against their siblings while maintaining their padded active and hover states.

<Flex gap="3" align="center">
<Select.Root defaultValue="apple">
<Select.Trigger variant="surface" />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root defaultValue="apple">
<Select.Trigger variant="ghost" />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
</Flex>

Color

Use the color prop on Trigger and Content to assign a specific color value, ignoring the global theme.

<Flex gap="3">
<Select.Root defaultValue="apple">
<Select.Trigger color="indigo" variant="soft" />
<Select.Content color="indigo">
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root defaultValue="apple">
<Select.Trigger color="cyan" variant="soft" />
<Select.Content color="cyan">
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root defaultValue="apple">
<Select.Trigger color="orange" variant="soft" />
<Select.Content color="orange">
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root defaultValue="apple">
<Select.Trigger color="crimson" variant="soft" />
<Select.Content color="crimson">
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
</Flex>

High-contrast

Use the highContrast prop on Content to increase item contrast.

<Flex gap="3">
<Select.Root defaultValue="apple">
<Select.Trigger variant="soft" />
<Select.Content variant="solid">
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root defaultValue="apple">
<Select.Trigger variant="soft" />
<Select.Content variant="solid" highContrast>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
</Flex>

Radius

Use the radius prop to assign a specific radius value, ignoring the global theme.

<Flex gap="3">
<Select.Root defaultValue="apple">
<Select.Trigger radius="none" />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root defaultValue="apple">
<Select.Trigger radius="large" />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
<Select.Root defaultValue="apple">
<Select.Trigger radius="full" />
<Select.Content>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="orange">Orange</Select.Item>
</Select.Content>
</Select.Root>
</Flex>

Placeholder

Use the placeholder prop to create a Trigger that doesn’t need an initial value.

<Select.Root>
<Select.Trigger placeholder="Pick a fruit" />
<Select.Content>
<Select.Group>
<Select.Label>Fruits</Select.Label>
<Select.Item value="orange">Orange</Select.Item>
<Select.Item value="apple">Apple</Select.Item>
<Select.Item value="grape" disabled>
Grape
</Select.Item>
</Select.Group>
<Select.Separator />
<Select.Group>
<Select.Label>Vegetables</Select.Label>
<Select.Item value="carrot">Carrot</Select.Item>
<Select.Item value="potato">Potato</Select.Item>
</Select.Group>
</Select.Content>
</Select.Root>