Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Combobox examples · Custom Actions

Recent Selections Section Combobox for React

A combobox with a Recent section of files above the full list.

Framework
UI library

A file picker that puts recently opened files first. package.json and index.tsx sit under Recent with a clock icon, and README.md, tsconfig.json and App.tsx follow under All Files. Use it for file pickers and switchers, where people go back to the same few items.

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 are the two sections built?

Two ComboboxGroups, Recent and All Files, with a ComboboxSeparator between them. Each group starts with a ComboboxLabel.

How is the clock drawn?

A ClockIcon at size-3 opacity-50, only in the Recent rows and hidden from screen readers.

Why aren't recent files listed twice?

All Files leaves out the recent ones, so each file has one row and one value.

Does Recent update when I pick a file?

Not in this demo: the list is fixed. Store the last few picks, newest first, and build the Recent group from them to make it live.

What does the button show?

The picked file name, or Select file... before a pick.