Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Menubar examples · Standard

Menubar with Icons for React

A File menu with an icon before New File, Open and Save.

Framework
UI library

Icons let people find a command without reading every row. This menubar's File menu puts a file, folder and save icon before New File, Open and Save. It fits editors and any app where the same commands are used often.

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

Where does each icon go?

First inside each MenubarItem, before the label. The item lays them out with a gap.

What size are these icons?

The item sizes them; the demo sets no size class. Add one, such as size-4, only to change it.

Which menu is this?

A single MenubarMenu whose MenubarTrigger reads File, with New File, Open and Save in its MenubarContent.

How do I add a hint beside Save?

Add a MenubarShortcut after the label, such as ⌘S. It lines up at the end of the row and only prints the hint.

Can I open File from the keyboard?

Yes. Focus the trigger and press Enter, Space or Arrow Down, then use the arrow keys and Enter.

Why is aria-hidden on the icon?

The label already says what the row does, so the icon is decoration. aria-hidden keeps screen readers from announcing it.