Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Combobox examples · Standard

Disabled State Combobox for React

A disabled combobox that shows its current value but can't be opened.

Framework
UI library

A combobox that's switched off. The button shows Option 1 in the dimmed disabled style and won't open, so the value can be read but not changed. Use it for fields that wait on another choice, or settings someone isn't allowed to edit.

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

What disables this combobox?

disabled on Combobox.

The trigger picks it up from the root, so the button needs no prop of its own.

Can someone still open the list?

No. A click or a key press on the disabled button leaves the list closed, and the button is skipped when tabbing.

Why does it still show a value?

The combobox starts with Option 1 selected, and disabling it doesn't clear the value. defaultValue is the first option.

What would the list contain?

Option 1, Option 2 and Option 3, with a Search option... box and No option found. when a search matches nothing. It's all there for when the combobox is turned back on.

Should I use disabled or read-only?

Disabled says the field doesn't apply right now and is usually left out of a form submission. When the value matters but can't be changed, show it as text instead, as in the read-only view.

How do I tell people why it's disabled?

The disabled style alone doesn't explain anything. Put a short line under the field, such as Pick a project first, and remove the disabled state as soon as the condition is met.