Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Menubar for React

A persistent row of menus for app commands.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/base/menubar.json

Anatomy

Menubar
├── MenubarMenu
│   ├── MenubarTrigger
│   └── MenubarContent
│       ├── MenubarGroup
│       │   ├── MenubarLabel
│       │   ├── MenubarItem
│       │   └── MenubarItem
│       ├── MenubarSeparator
│       ├── MenubarGroup
│       │   ├── MenubarCheckboxItem
│       │   └── MenubarCheckboxItem
│       ├── MenubarRadioGroup
│       │   ├── MenubarRadioItem
│       │   └── MenubarRadioItem
│       └── MenubarSub
│           ├── MenubarSubTrigger
│           └── MenubarSubContent
│               └── MenubarItem
└── MenubarMenu
    ├── MenubarTrigger
    └── MenubarContent

Usage

import {
  Menubar,
  MenubarContent,
  MenubarGroup,
  MenubarItem,
  MenubarMenu,
  MenubarSeparator,
  MenubarShortcut,
  MenubarTrigger,
} from "@/components/ui/menubar";
<Menubar>
  <MenubarMenu>
    <MenubarTrigger>File</MenubarTrigger>
    <MenubarContent>
      <MenubarGroup>
        <MenubarItem value="new-tab">
          New Tab <MenubarShortcut>⌘T</MenubarShortcut>
        </MenubarItem>
        <MenubarItem value="new-window">New Window</MenubarItem>
      </MenubarGroup>
      <MenubarSeparator />
      <MenubarGroup>
        <MenubarItem value="share">Share</MenubarItem>
        <MenubarItem value="print">Print</MenubarItem>
      </MenubarGroup>
    </MenubarContent>
  </MenubarMenu>
</Menubar>

Accessibility

KeyDescription
Enter
Activate the focused control.
Space
Activate the focused control.
ArrowDown
Move down.
ArrowUp
Move up.
ArrowLeft
Move left.
ArrowRight
Move right.
Home
Go to the start.
End
Go to the end.

Demos

Checkbox

Use MenubarCheckboxItem for toggleable options.

Radio

Use MenubarRadioGroup and MenubarRadioItem for single-select options.

Use MenubarSub, MenubarSubTrigger, and MenubarSubContent for nested menus.

Icons

Combine icons with labels for quick scanning.

Rtl

Right-to-left menubar. See the RTL configuration guide for document direction.

API Reference

PropType
AttributeType
PropType
AttributeType
PropType
AttributeType
PropType
AttributeType
PropType
children?React.ReactNode
AttributeType
PropType
children?React.ReactNode
id?string
AttributeType
PropType
id?string
AttributeType

div

PropType
id?string
AttributeType
PropType
AttributeType

div

PropType
id?string
AttributeType
PropType
AttributeType
PropType
AttributeType
PropType
AttributeType
PropType
AttributeType
PropType
id?string
AttributeType
PropType
children?React.ReactNode
id?string
AttributeType