Overlays & Actions
Menubar
Desktop-style menu bar: one open root menu at a time, submenus, shortcuts, checkboxes, and radio groups. Reveal the right amount of context without losing the user's place in the interface. Keep the trigger, content and dismissal behavior working as one interaction. Import it from @/components/kamod-ui/menubar.
Source · Design reference · API reference · Theming · Styles
Installation
Import Menubar, MenubarMenu, MenubarTrigger, MenubarContent, and optional primitives (Group, Shortcut, Sub, CheckboxItem, RadioGroup, …) from @/components/kamod-ui/menubar.
pnpm add @kamod-ch/uiCopy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.
Usage
Each MenubarMenu is a top-level branch. Only one menu panel is open at a time; choosing another trigger switches panels. MenubarItem closes the bar on activate; checkbox and radio items keep it open. Submenus open on hover or click.
import { Menubar } from "@kamod-ch/ui";Choose a complete composition from the examples below; required child components and props vary by pattern.
Component Examples & Variants
Explore Menubar in Different Contexts, from the starting pattern to the compositions below. Begin with Demo, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.
Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.
Demo
Organize Application Commands into Familiar Categories. Compose File, Edit, View and profile menus to explore a complete application menubar. Submenus, checkbox settings and radio choices demonstrate different action types; the displayed shortcut hints and sample values still need application behavior behind them.
Replace static demonstration values with real state, and keep displayed keyboard shortcuts synchronized with the handlers your application actually registers.
// Mirrors https://ui.shadcn.com/docs/components/radix/menubar — see MenubarDemo in menubar-doc.tsxMinimal
Start with One Coherent Command Category. Begin with a small menubar group and one shortcut hint to establish the relationship between a top-level trigger and its commands. Additional menus can follow the same structure when their actions form distinct categories.
Keep the trigger meaningful, connect items to real actions and treat shortcut text as documentation of behavior rather than as a shortcut implementation.
Checkbox
Represent Independent Preferences within a Menu. Use MenubarCheckboxItem for an independent boolean preference inside a menu. Supply checked and onCheckedChange when its value belongs in parent state, allowing other controls to reflect the same setting.
Keep each label clear about the enabled behavior, and decide whether changes take effect immediately or must be saved in a separate workflow.
Radio
Show One Selected Mode Among Alternatives. Use MenubarRadioGroup with value and onValueChange when only one option may be active. The menu shows the current choice while the parent can apply that same value to the rest of the application.
Bind the selection to a single source of truth and use stable values; the displayed checked item should agree with the application's current behavior after reopening the menu.
With Icons
Make Scanning Faster without Changing Meaning. Place recognizable icons before menu labels and use the destructive variant only for actions with that consequence. The visual treatment supplements the text, keeping the menu understandable even when an icon is unfamiliar.
Keep decorative icons out of the accessible name and separate risky operations through clear wording and grouping rather than relying on a red icon alone.
Props and Data
Configure Menubar using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.
Props, slots and variants for this component.
Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.
Component Props
? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.Data Type Reference
Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.
Menubar Props
2 declared fieldsMenubarPropsMenubar.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarProps before adapting it.MenubarCheckboxItem Props
4 declared fieldsMenubarCheckboxItemPropsMenubarCheckboxItem.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarCheckboxItemProps before adapting it.MenubarContent Props
1 declared fieldMenubarContentPropsMenubarContent.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarContentProps before adapting it.MenubarGroup Props
1 declared fieldMenubarGroupPropsMenubarGroup.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarGroupProps before adapting it.MenubarItem Props
3 declared fieldsMenubarItemPropsMenubarItem.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarItemProps before adapting it.MenubarLabel Props
1 declared fieldMenubarLabelPropsMenubarLabel.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarLabelProps before adapting it.MenubarMenu Props
2 declared fieldsMenubarMenuPropsMenubarMenu.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarMenuProps before adapting it.MenubarRadioGroup Props
4 declared fieldsMenubarRadioGroupPropsMenubarRadioGroup.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarRadioGroupProps before adapting it.MenubarRadioItem Props
2 declared fieldsMenubarRadioItemPropsMenubarRadioItem.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarRadioItemProps before adapting it.valueMenubarSeparator Props
DeclarationMenubarSeparatorPropsMenubarSeparator.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarSeparatorProps before adapting it.MenubarShortcut Props
1 declared fieldMenubarShortcutPropsMenubarShortcut.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarShortcutProps before adapting it.MenubarSub Props
1 declared fieldMenubarSubPropsMenubarSub.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarSubProps before adapting it.MenubarSubContent Props
1 declared fieldMenubarSubContentPropsMenubarSubContent.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarSubContentProps before adapting it.MenubarSubTrigger Props
1 declared fieldMenubarSubTriggerPropsMenubarSubTrigger.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarSubTriggerProps before adapting it.MenubarTrigger Props
1 declared fieldMenubarTriggerPropsMenubarTrigger.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarTriggerProps before adapting it.MenubarRootContextValue
4 declared fieldsMenubarRootContextValuemenubar-context.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarRootContextValue before adapting it.openMenuId, setOpenMenuId, rootRef, rememberTriggerMenubarMenuContextValue
2 declared fieldsMenubarMenuContextValuemenubar-context.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarMenuContextValue before adapting it.menuId, triggerRefMenubarRadioContextValue
3 declared fieldsMenubarRadioContextValuemenubar-context.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarRadioContextValue before adapting it.selected, controlledValue, setValueMenubarSubContextValue
4 declared fieldsMenubarSubContextValuemenubar-context.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarSubContextValue before adapting it.open, setOpen, markFocusOnOpen, consumeFocusOnOpenAccessibility
Build the Complete Interaction, Including the Parts Outside Menubar. The notes below distinguish the current implementation from the labels, content and behavior your application supplies. Start with the Live Preview, check the Props and Data Reference, and test the finished composition with real content rather than assuming that an unchanged visual example covers every use case.
Built-in Behavior and Defaults
Menubar exposes role="menubar"; its triggers report expanded state and its panels/items use menu semantics. This represents application actions, not a general collection of website links.
Labels and Relationships
Use familiar action categories and descriptive item names. Keep keyboard hints consistent with shortcuts your application actually implements. Name the menubar where needed to distinguish it from another application control region.
Keyboard and Focus
Review movement between top-level triggers, entry into a menu, submenu traversal and Escape as one keyboard system. Verify the shipped behavior in your target browser rather than adding a role and assuming the interaction appears automatically.
States and Integration Details
A menu item's visual selected style is not a substitute for checkbox/radio state. Avoid mixing unrelated form controls into a menu without a suitable interaction model, and leave site navigation in navigation landmarks.
Verify the Complete Interaction
Check Behavior as Well as Markup. Work through these scenarios in the application where the component will be used. Automated checks can help find structural problems; also review the reading experience with a screen reader, keyboard focus and the actual feedback from your application.
- Complete a top-level and a nested action without using the pointer.
- Check disabled, checked and radio menu items with a screen reader.
- Verify advertised shortcuts, Escape dismissal and focus continuity when menu content changes.
Recheck the result after changing Theme Tokens, translations or class overrides. Include text enlargement, narrow layouts and reduced-motion settings where animation is present. Inspect the Component Source when a behavior differs from your expectation; a role or state attribute does not implement keyboard interaction by itself.
For background, read the WAI-ARIA Authoring Guidance and Keyboard Interface Guidance. These explain the patterns; verify browser and assistive-technology behavior for the implementation and audience you actually support.
You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.
Connect the Foundation
Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.
Build the Surrounding Screen
Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.
Make the Result Hold Up
Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.
Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.