Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Field examples · Selects

Select with Default Value Field for React

An account status select that opens on Active, with a description below.

Framework
UI library

A Select that already has an answer, for fields with a sensible default. Status opens on Active, with no placeholder, and a FieldDescription under it says what the value is.

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 Status open on Active?

The trigger shows the selected label, and this select has no placeholder. The items are Active, Pending, Suspended, and Inactive. Set defaultValue to active.

Where is the helper text?

FieldDescription comes after the Select and reads Current account status. The label Status comes first.

How does the Status label connect?

FieldLabel names the select. Its htmlFor matches the SelectTrigger's id. The label text is Status.

Where do the four statuses go?

Active, Pending, Suspended, and Inactive are SelectItems. Opening the select shows that list, and the trigger keeps the selected label.

Why is the label above the trigger?

orientation is unset, so the field stays vertical. max-w-md caps the width.

How do I show a placeholder instead of Active?

Remove defaultValue and set a placeholder. The trigger then shows that prompt until someone picks a status. It goes on SelectValue.