Application menubar on Radix: one panel walks along the bar, the trigger pill leads, the surface takes the next menu's shape while items swap.
Click meTap me
Q3 revenue report
Edited 2 minutes ago
Saved
100 %
Quarterly summary
Revenue closed the quarter ahead of plan, led by renewals in the mid-market segment.
Next quarter focuses on onboarding time and the self-serve plan.
menubar · , lively
menubar-demo.tsx
When to use
Use it for the application menus of an editor, admin console or BI tool: several menus side by side, each with actions, view options and submenus. Shortcuts are printed only, so you bind the keys yourself.
When not to use
For the actions on a single thing like a table row use Dropdown Menu. For a long list of commands with a filter use Command Palette.
Every choice lands on the page next to the bar: Edit names the step it will undo ("Undo insert bar chart") and greys out when the stack is empty, View's checks and zoom reshape the document at once, Insert drops the block onto the page (undoable), and the printed shortcuts (⌘Z, ⇧⌘Z, ⌘') work while focus is in the editor.
Use it for the application menus of an editor, an admin console, a BI tool or a design app: File, Edit, View, Insert, Share, each with actions, view options and submenus. It is the bar of several menus side by side; for the actions on a single thing (a table row, a header button) use the dropdown menu, and for a long list of commands with a filter use the command palette.
The motion follows the three beats. Pressing a trigger charges it: it sinks and the pill leans 2 px toward it. On release the panel acts: it grows out of the trigger's pill into the menu, and its items cascade in from the bar. Then hover or arrow to the next trigger: the bar does not close one menu and open the next. The pill stretches to the new trigger and the one panel surface follows on the same spring, walking along the bar and taking the next menu's width and height while the old items leave through its bottom and the new ones arrive; the pill contracts onto the trigger and the rim settles. The surface never bounces and items are clipped by it, so no row is ever drawn off the panel mid-walk. View options kick a check ball, a radio group's ball travels between its rows, and a submenu buds from a 6 px ball at its row's end. calm shortens and quiets the walk (0.26 s, 30 ms stagger), playful moves more.
The parts mirror Radix Menubar and shadcn's flat names, so existing shadcn code keeps working; they are also on the namespace (Menubar.Menu, Menubar.Item, …). The root's value is the open menu (a MenubarMenu's value, "" when closed), controlled or uncontrolled (defaultValue, onValueChange); loop and dir pass through to Radix. An item's onSelect runs at once and the bar closes after the row's short sink; keepOpen keeps it open (view options), and event.preventDefault() works as in Radix. A disabled row stays in place, dimmed, skipped by the arrows and never fires: name it for its state ("Nothing to redo") rather than hiding it, so the menu keeps its shape. The shortcut pill only prints the keys: bind them yourself, scoped to the surface they act on. MenubarContent takes its widest row, or a fixed width in px. Panels portal to container, else MotionKitProvider's portalContainer, else document.body; boundary keeps them inside a card.
Pick a layout with preset (bar, toolbar, inline) and a density with size (sm, md). The motion is the same in every preset. Set the character app-wide with MotionKitProvider, or per bar with temperament.
The toolbar preset: icon triggers with labels under them (icons only below 640 px), each panel centred under its icon. Every menu answers on the frame: Shapes adds a layer, Text restyles the caption and toggles the baseline grid while the panel stays open, Layers swaps the stacking order (the row that would do nothing is disabled), groups and locks.
The inline preset: small triggers in a card header with no bar surface, the raised pill alone marks the open menu, and boundary keeps every panel inside the card. Columns hides cells, and a new sort slides each row to its place.
Built on Radix Menubar: the bar is a menubar with roving focus, triggers are menuitem with aria-haspopup, aria-expanded and aria-controls, each panel is a menu labelled by its trigger, items are menuitem, menuitemcheckbox and menuitemradio with aria-checked. Give the bar an aria-label.
The panel walks with the keyboard too: ArrowLeft and ArrowRight move to the neighbouring menu and its first row takes focus. While keys drive the bar, the open trigger keeps a ring focus ring (it sits on the trigger, above the pill, never under the surface) and the row highlight carries a ring-tinted rim at 3:1.
The pill, the walking surface, the highlight tile, the check and radio balls and the slot rings are aria-hidden; the state is in aria-checked. Checked balls use primary, focus uses ring, the highlight accent.
Rows are 32 px tall (28 px at sm), triggers 36 px (28 px at sm and below 640 px). Trigger labels use foreground at 75 %, shortcut pills and labels muted-foreground on popover: AA in both themes.
Below 640 px a submenu opens as a layer under its row, exactly as wide, so it stays inside a 320 px screen; ArrowRight still opens it and ArrowLeft returns to the row. When the menus do not fit the bar, it scrolls sideways (no scrollbar) and the focused trigger scrolls into view.
Disabled rows carry aria-disabled and are skipped by the arrow keys; their text uses muted-foreground.
Code that opens a menu (a tour, a replay) never steals focus: only the person's own open moves focus into the panel.
With reduced motion (the OS setting, or MotionKitProvider reducedMotion="always") nothing walks, sinks or buds: each panel draws its own surface and crossfades in place at the new trigger, its items fade in together, the pill glides between triggers in the fade time without stretching, the check ball and the radio ball appear without a kick or a squash and submenus fade in beside their row. The open menu is the same picture as the walk's last frame, and every key works the same.
The walk animates one absolutely positioned surface (x, y, width, height, radius) with the panels' clip-path driven by its motion values: the box is measured once per switch with getBoundingClientRect, never in a frame loop, and the rim is a box-shadow on real width and height, so nothing is counter-scaled. Rows, the pill, the highlight and the balls animate transform and opacity.
Nothing runs at rest and nothing loops. Only the open menu and the one leaving are mounted.
Third-party dependencies, measured apart: @radix-ui/react-menubar (with @radix-ui/react-menu, shared with the dropdown menu) and motion.
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, @radix-ui/react-menubar, motion.
Dependencies
@radix-ui/react-menubar · peer
motion · peer
Triggers
click, hover, press, pointer movement
Reduced motion
No walk, sink or bud: each panel draws its own surface and crossfades in place, items fade in together, the pill glides without stretching, the balls appear without kick or squash.
Keyboard
Tab
Focuses the bar (one tab stop); the pill comes to the focused trigger
ArrowLeft / ArrowRight (bar)
Previous / next trigger
Enter / Space / ArrowDown on a trigger
Opens the menu out of the trigger's pill, focus on the first row
ArrowLeft / ArrowRight (open menu)
The panel walks to the previous / next menu, focus on its first row
ArrowDown / ArrowUp
Next / previous row; the highlight glides, and stretches across a label
Home / End
First / last row
Type a letter
Moves to the next row starting with it
Enter / Space
Chooses the row (it sinks, then the bar closes); toggles a checkbox row, picks a radio row
ArrowRight on a submenu row
Opens the submenu from its bud, focus on its first row
Escape
Closes the menu, focus back on its trigger
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)