Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Combobox examples · Multi Select

With Item Count in Trigger Combobox for React

A multi-select combobox that sums up the picked skills on its button.

Framework
UI library

A skill picker whose button reads 2 skills selected, with the plural worked out from the count. JavaScript and TypeScript start selected. Use it where the button has to stay narrow and the number of picks is the useful summary.

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 label built?

From the number of selected values: skill gets an s when there is more than one, so it reads 1 skill selected or 3 skills selected. With nothing picked it says Select skills....

What is selected at first?

JavaScript and TypeScript, the starting value of the selection the demo keeps.

Which skills are listed?

JavaScript, TypeScript, Python, Rust, Go and Java. The search box says Search skills..., and No skill found. shows when nothing matches.

How are picked skills marked?

ComboboxItem shows its check on every picked row, and a second pick clears it.

Can I show the names instead?

Yes, join the selected labels into the button text. Fall back to the count once the names no longer fit the 200px button.

Does the plural work in other languages?

No, the s rule only fits English. Use Intl.PluralRules or your translation library to pick the right form.