Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Command examples · Standard

Command with Descriptions for React

An inline command menu of contact details, each with a muted second line naming what it is.

Framework
UI library

Four contact details, each with a muted second line that says what it is: a job title, Email, Mobile or Location. Add a second line when the labels alone could be mistaken for one another. The menu sits in the page, always open, with no trigger. In React, Base UI handles the keyboard navigation.

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 this menu placed on the page?

Command has h-auto w-full max-w-lg rounded-lg border shadow-md: it sits in the page flow, up to a max width, with a border and a shadow. The list is always open and there is no trigger.

How does each contact get a second line?

The name and the detail sit in a div with flex flex-col. The detail is a span with text-muted-foreground text-xs: Software Engineer under John Doe, Email under jane@example.com, Mobile under the phone number, and Location under San Francisco, CA. The search matches the first line only.

What are the icons beside the contacts?

User, Mail, Phone and MapPin, the first child of each CommandItem. They're decorative and hidden from screen readers, and the item centers each one against the two lines.

What appears when nothing matches the search?

CommandEmpty in the list says "No contacts found." It shows only when the search leaves nothing.

How do I run an item from this menu in React?

These items don't run anything yet. Pass onSelect to each CommandItem.

How do the keys work in this menu?

The arrow keys move through the items, Enter runs the highlighted one, and typing filters the list. CommandInput shows "Search contacts..." until someone types. Command filters and ranks the items by their text on its own.