Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Combobox examples · Rich Content

Color-Coded Items Combobox for React

A combobox with a colored dot beside each label, shown on the button once one is picked.

Framework
UI library

An issue-label picker where every label has its own color: Bug, Feature, Improvement, Documentation and Question. The dot sits before the name in the list and on the button after a pick. Use it for labels, tags and categories that people already know by color.

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 is the dot drawn?

A span with size-3 rounded-full and the label's background class. It's aria-hidden, since the name next to it says the same thing.

Which colors does it use?

Theme colors, so they follow light and dark mode: bg-destructive for Bug, bg-info for Feature, bg-success for Improvement, bg-primary for Documentation and bg-warning for Question.

How does the button show the dot?

It renders the picked label's dot and name side by side, and Select label... before a pick. ComboboxValue takes a function that gets the picked label.

Is color the only cue?

No. Every dot has its name beside it, so the labels can be told apart without seeing color.

Can I add my own colors?

Yes. Store any background class with the label, or set the dot's color inline from a hex value saved with the label.