ui

Select

A common form component for choosing a predefined value in a dropdown menu. Built with Base UI and Tailwind CSS. Copy-paste ready.

API Reference

Installation

Usage

Examples

For accessible labelling and validation, prefer using the Field component to wrap selects. See the related example: Select field.

Sizes

Renders the sm, default, and lg size variants to show how the select trigger scales across layout contexts.

With Groups

Organizes options into labeled SelectGroup sections for categorized lists such as timezones or regions.

Multiple Selection

Allows selecting multiple values simultaneously, displaying them as a comma-separated list in the trigger.

Options with Icon

Prepends an icon to each option in the dropdown for visual identification of the available choices.

With Object Values

Demonstrates using complex object values (e.g. { id, label }) rather than plain strings, letting you store structured data on selection.

Form Integration

Wraps the select in Form and Field for required validation and a FieldError displayed on submit.

With Disabled Options

Active role options are listed first; unavailable roles (Guest, Contractor) appear below a separator as disabled items with a "coming soon" label.

Country Selector with Groups

Options organized into SelectGroup regions (Americas, Europe, Asia Pacific) with SelectGroupLabel headings for each continent.

Controlled with External Display

A priority selector whose selected value drives a Badge rendered below the trigger — shows how to wire onValueChange to external UI.

Items with Description

Each dropdown option includes a secondary description line below its label — useful for environment selectors, plan tiers, or deployment targets.

Sort Order with Icons

A compact sort select where each option is prefixed with a lucide-react icon representing the sort direction or criteria.