Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

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


Interactive Live Preview
Try it. Make it yours.

Installation

Import Menubar, MenubarMenu, MenubarTrigger, MenubarContent, and optional primitives (Group, Shortcut, Sub, CheckboxItem, RadioGroup, …) from @/components/kamod-ui/menubar.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy 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 SetupTypeScript
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.

src/components/MenubarExample.tsx1 line
// Mirrors https://ui.shadcn.com/docs/components/radix/menubar — see MenubarDemo in menubar-doc.tsx

Minimal

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.

Interactive Live Preview
Try it. Make it yours.

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.

Interactive Live Preview
Try it. Make it yours.

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.

Interactive Live Preview
Try it. Make it yours.

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.

Interactive Live Preview
Try it. Make it yours.
API reference

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.

API reference
Your API, from source

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

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? 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.
@kamod-ch/ui/menubar28.6 KB min · 6.4 KB gzipSignals: direct@preact/signals

Menubar

MenubarProps

Menubar documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarProps

Configure children for Menubar. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarProps

Configure class for Menubar. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
dir
"rtl" | "ltr" | (SignalLike<"auto" | "rtl" | "ltr" | undefined> & "rtl") | (SignalLike<"auto" | "rtl" | "ltr" | undefined> & "ltr")MenubarProps

Configure dir for Menubar. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarCheckboxItem

MenubarCheckboxItemProps

MenubarCheckboxItem documented props
Prop / typeDescription
checked
booleanMenubarCheckboxItemProps

Configure checked for MenubarCheckboxItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
children
ComponentChild[] | ComponentChildMenubarCheckboxItemProps

Configure children for MenubarCheckboxItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarCheckboxItemProps

Configure class for MenubarCheckboxItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
defaultChecked
booleanMenubarCheckboxItemProps

Configure defaultChecked for MenubarCheckboxItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
disabled
boolean | SignalLike<boolean | undefined>MenubarCheckboxItemProps

Configure disabled for MenubarCheckboxItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onCheckedChange
((checked: boolean) => void)MenubarCheckboxItemProps

Configure onCheckedChange for MenubarCheckboxItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLButtonElement>MenubarCheckboxItemProps

Configure onClick for MenubarCheckboxItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarContent

MenubarContentProps

MenubarContent documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarContentProps

Configure children for MenubarContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarContentProps

Configure class for MenubarContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onKeyDown
KeyboardEventHandler<HTMLDivElement>MenubarContentProps

Configure onKeyDown for MenubarContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarGroup

MenubarGroupProps

MenubarGroup documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarGroupProps

Configure children for MenubarGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarGroupProps

Configure class for MenubarGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarItem

MenubarItemProps

MenubarItem documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarItemProps

Configure children for MenubarItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarItemProps

Configure class for MenubarItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
disabled
boolean | SignalLike<boolean | undefined>MenubarItemProps

Configure disabled for MenubarItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
inset
booleanMenubarItemProps

Configure inset for MenubarItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
onClick
MouseEventHandler<HTMLButtonElement>MenubarItemProps

Configure onClick for MenubarItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
variant
"default" | "destructive"MenubarItemProps

Configure variant for MenubarItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"default"

MenubarLabel

MenubarLabelProps

MenubarLabel documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarLabelProps

Configure children for MenubarLabel. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarLabelProps

Configure class for MenubarLabel. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarMenu

MenubarMenuProps

MenubarMenu documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarMenuProps

Configure children for MenubarMenu. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarMenuProps

Configure class for MenubarMenu. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
value
stringMenubarMenuProps

Optional stable id; auto-generated when omitted.

Default
—

MenubarRadioGroup

MenubarRadioGroupProps

MenubarRadioGroup documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarRadioGroupProps

Configure children for MenubarRadioGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarRadioGroupProps

Configure class for MenubarRadioGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
defaultValue
stringMenubarRadioGroupProps

Configure defaultValue for MenubarRadioGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
""
onValueChange
((value: string) => void)MenubarRadioGroupProps

Configure onValueChange for MenubarRadioGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
value
stringMenubarRadioGroupProps

Configure value for MenubarRadioGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarRadioItem

MenubarRadioItemProps

MenubarRadioItem documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarRadioItemProps

Configure children for MenubarRadioItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarRadioItemProps

Configure class for MenubarRadioItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
disabled
boolean | SignalLike<boolean | undefined>MenubarRadioItemProps

Configure disabled for MenubarRadioItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLButtonElement>MenubarRadioItemProps

Configure onClick for MenubarRadioItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
value
Signalish<string | number | undefined> & stringMenubarRadioItemProps

Configure value for MenubarRadioItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarSeparator

MenubarSeparatorProps

MenubarSeparator documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>MenubarSeparatorProps

Configure class for MenubarSeparator. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarShortcut

MenubarShortcutProps

MenubarShortcut documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarShortcutProps

Configure children for MenubarShortcut. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarShortcutProps

Configure class for MenubarShortcut. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarSub

MenubarSubProps

MenubarSub documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarSubProps

Configure children for MenubarSub. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarSubProps

Configure class for MenubarSub. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarSubContent

MenubarSubContentProps

MenubarSubContent documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarSubContentProps

Configure children for MenubarSubContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarSubContentProps

Configure class for MenubarSubContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onKeyDown
KeyboardEventHandler<HTMLDivElement>MenubarSubContentProps

Configure onKeyDown for MenubarSubContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onPointerEnter
PointerEventHandler<HTMLDivElement>MenubarSubContentProps

Configure onPointerEnter for MenubarSubContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarSubTrigger

MenubarSubTriggerProps

MenubarSubTrigger documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarSubTriggerProps

Configure children for MenubarSubTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarSubTriggerProps

Configure class for MenubarSubTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLButtonElement>MenubarSubTriggerProps

Configure onClick for MenubarSubTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onKeyDown
KeyboardEventHandler<HTMLButtonElement>MenubarSubTriggerProps

Configure onKeyDown for MenubarSubTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onPointerEnter
PointerEventHandler<HTMLButtonElement>MenubarSubTriggerProps

Configure onPointerEnter for MenubarSubTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

MenubarTrigger

MenubarTriggerProps

MenubarTrigger documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildMenubarTriggerProps

Configure children for MenubarTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>MenubarTriggerProps

Configure class for MenubarTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLButtonElement>MenubarTriggerProps

Configure onClick for MenubarTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onKeyDown
KeyboardEventHandler<HTMLButtonElement>MenubarTriggerProps

Configure onKeyDown for MenubarTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
ref
Ref<HTMLButtonElement>MenubarTriggerProps

Configure ref for MenubarTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

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 fields
MenubarProps
Exported Source Declaration from Menubar.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 fields
MenubarCheckboxItemProps
Exported Source Declaration from MenubarCheckboxItem.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 field
MenubarContentProps
Exported Source Declaration from MenubarContent.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 field
MenubarGroupProps
Exported Source Declaration from MenubarGroup.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 fields
MenubarItemProps
Exported Source Declaration from MenubarItem.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 field
MenubarLabelProps
Exported Source Declaration from MenubarLabel.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 fields
MenubarMenuProps
Exported Source Declaration from MenubarMenu.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 fields
MenubarRadioGroupProps
Exported Source Declaration from MenubarRadioGroup.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 fields
MenubarRadioItemProps
Exported Source Declaration from MenubarRadioItem.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of MenubarRadioItemProps before adapting it.
Required fields
value
MenubarSeparatorProps
Exported Source Declaration from MenubarSeparator.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 field
MenubarShortcutProps
Exported Source Declaration from MenubarShortcut.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 field
MenubarSubProps
Exported Source Declaration from MenubarSub.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 field
MenubarSubContentProps
Exported Source Declaration from MenubarSubContent.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 field
MenubarSubTriggerProps
Exported Source Declaration from MenubarSubTrigger.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 field
MenubarTriggerProps
Exported Source Declaration from MenubarTrigger.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 fields
MenubarRootContextValue
Exported Source Declaration from menubar-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.
Required fields
openMenuId, setOpenMenuId, rootRef, rememberTrigger

MenubarMenuContextValue

2 declared fields
MenubarMenuContextValue
Exported Source Declaration from menubar-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.
Required fields
menuId, triggerRef

MenubarRadioContextValue

3 declared fields
MenubarRadioContextValue
Exported Source Declaration from menubar-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.
Required fields
selected, controlledValue, setValue

MenubarSubContextValue

4 declared fields
MenubarSubContextValue
Exported Source Declaration from menubar-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.
Required fields
open, setOpen, markFocusOnOpen, consumeFocusOnOpen

Accessibility

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.

  1. Complete a top-level and a nested action without using the pointer.
  2. Check disabled, checked and radio menu items with a screen reader.
  3. 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.

Take the Next Useful Step

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.