Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Field examples · Selects

Simple Select Field for React

A country select with a label and a placeholder.

Framework
UI library

A Select for one choice from a known list: a Country label above a trigger that shows Select a country until someone picks United States, United Kingdom, Canada, Australia or Germany.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How does the Country label connect to the select?

FieldLabel names the select. Its htmlFor matches the SelectTrigger's id. The label text is Country, stacked above the trigger.

What shows before a country is chosen?

The placeholder Select a country shows until an item is selected. It's the placeholder on SelectValue.

Where do the countries go?

Each country is a SelectItem: United States, United Kingdom, Canada, Australia, and Germany.

How wide is the trigger?

The field is capped with max-w-md, and the trigger fills that width.

Why is the label above the trigger?

orientation is unset, so the field stays vertical. The label takes the full width of the field.

How do I add a sentence under the select?

Put FieldDescription after the Select. This demo ends at the select.