Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Combobox examples · Standard

Full Width Variant Combobox for React

A combobox whose button and list stretch to the width of their container.

Framework
UI library

A country picker that fills its column. The button takes w-full, and the list opens at the button's width, so the combobox lines up with the other inputs in a form. Use it in form layouts, side panels and on narrow screens where fixed widths look out of place.

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

Which classes make it full width?

A wrapper div with w-full, and w-full justify-between on the trigger so the label sits at the start and the chevron at the end.

How does the list match the button's width?

ComboboxContent reads the width of the element it's anchored to, so a wider button gives a wider list without a width class on the popup.

What can I select?

United States, United Kingdom, Canada, Australia and Germany. The search box says Search country..., and No country found. shows when nothing matches.

What does the button show?

Select country... until a country is picked, then its name.

Can I cap the width on large screens?

Yes. Swap w-full on the wrapper for w-full max-w-md or similar. The button and the list follow the wrapper.

Does it work on phones?

Yes. The list opens under the button at the same width and scrolls when it's taller than the space below.