NavigationAvailable
Menubar
Desktop-style grouped commands with arrow-key navigation.
Installation
Add the component and its dependencies from the registry running on your computer.
terminal
npx shadcn@latest add https://brutallab.facilito.dev/r/menubar.jsonUsage
Import the component into your project and keep the source code under your control.
tsx
'use client';
import { useState } from 'react';
import {
Menubar,
MenubarMenu,
MenubarTrigger,
MenubarContent,
MenubarItem,
} from '@/components/ui/menubar';
export default function Demo() {
const [action, setAction] = useState('Choose a command.');
return (
<div className="grid gap-4">
<Menubar>
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarItem onClick={() => setAction('New file selected')}>
New file
</MenubarItem>
<MenubarItem onClick={() => setAction('Open selected')}>
Open
</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>Edit</MenubarTrigger>
<MenubarContent>
<MenubarItem onClick={() => setAction('Undo selected')}>
Undo
</MenubarItem>
<MenubarItem disabled>Redo</MenubarItem>
</MenubarContent>
</MenubarMenu>
</Menubar>
<output>{action}</output>
</div>
);
}
States & interaction
Appearance, behavior and keyboard checks.
- Check closed, open, highlighted, selected and disabled states where supported.
- Dialogs and menus must open from the keyboard. Escape closes non-persistent overlays and returns focus to the trigger. Tooltips and hover cards must also appear on focus.
- Test the example with Tab and Shift+Tab. Focus must stay visible in both themes.
API Reference
BrutalLab-specific properties. Native attributes are supported as well.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | ? | Extends the root visual styles without changing its semantics. |
| children | ReactNode | ? | Compose the exported subcomponents as shown in the runnable example. |
Accessibility
Rules that should remain intact when adapting the component to a product.
Use a menubar for application commands, not ordinary website navigation.
Retain keyboard focus styles and test the composition with keyboard navigation.
Use className for visual customization; preserve the primitive ARIA attributes.