Search documentation

Search the documentation and open a page.

A visually persistent menu that provides quick access to a consistent set of commands.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/menubar

Composition

<div appMenubar> └── <app-menubar-menu> ├── <button appMenubarTrigger> └── <app-menubar-content> ├── [appMenubarLabel] (optional) ├── [appMenubarGroup] (optional) │ └── <div appMenubarItem> | <app-menubar-checkbox-item> │ ├── [appMenubarItemText] (optional) │ └── [appMenubarShortcut] (optional) ├── [appMenubarRadioGroup] (optional) │ └── <app-menubar-radio-item> ├── [appMenubarSeparator] (optional) ├── <app-menubar-sub> (optional) │ ├── <div appMenubarSubTrigger> │ └── <app-menubar-sub-content> └── <app-menubar-arrow> (optional)

Examples

Checkbox

Loading...

Default

Loading...

Radio

Loading...

With Icons

Loading...

API Reference

<app-menubar-menu>

Inputs

InputTypeDefaultDescription
idstring | undefinedgeneratedUnique identifier used to create IDs for the menu parts.
idsPartial<MenuElementIds> | undefined—Overrides generated identifiers for individual parts.
openboolean | undefined—Open state when controlled. Supports Angular two-way binding.
defaultOpenbooleanfalseInitial open state when uncontrolled.
highlightedValuestring | null | undefined—Highlighted item value when controlled. Supports Angular two-way binding.
defaultHighlightedValuestring | null | undefinednullInitially highlighted item value when uncontrolled.
loopFocusbooleanfalseWraps keyboard focus from the last item to the first and vice versa.
closeOnSelectboolean | undefinedtrueCloses the menu after an item is selected.
typeaheadboolean | undefinedtrueEnables character-based item navigation.
compositeboolean | undefinedtrueEnables composite-widget keyboard and focus behavior.
positioningMenuPositioningOptions | undefined{ placement: "bottom-start", gutter: 8 }Configures floating-element placement and collision handling.
aria-labelstring | undefined—Accessible label used when no visible element labels the menu.
anchorPointPoint | null | undefined—Coordinates used to position the menu at a specific point.
navigate((details: MenuNavigateDetails) => void) | null | undefinedactivates linksHandles navigation when a menu item represents a link.
triggerValuestring | null | undefined—Active trigger value when controlled. Supports Angular two-way binding.
defaultTriggerValuestring | null | undefinednullInitial active trigger value when uncontrolled.

Outputs

OutputTypeDescription
openChangeboolean | undefinedEmits the updated controlled open state.
highlightedValueChangestring | null | undefinedEmits the updated highlighted item value.
triggerValueChangestring | null | undefinedEmits the updated active trigger value.
selectMenuSelectionDetailsEmits when an item is selected.
escapeKeyDownKeyboardEventEmits when Escape is pressed while the menu is open.
focusOutsideMenuFocusOutsideEventEmits when focus moves outside the menu.
highlightChangeMenuHighlightChangeDetailsEmits details whenever the highlighted item changes.
interactOutsideMenuInteractOutsideEventEmits for an interaction outside the menu.
openChangeDetailsMenuOpenChangeDetailsEmits detailed information about an open-state change.
pointerDownOutsideMenuPointerDownOutsideEventEmits for a pointer-down event outside the menu.
requestDismissCustomEventEmits when another layer requests that this one dismiss.
triggerValueChangeDetailsMenuTriggerValueChangeDetailsEmits detailed information about a trigger-value change.

[appMenubarTrigger]

InputTypeDefaultDescription
valuestring | undefined—Value used to identify this trigger when activated.

<div appMenubarItem>

Inputs

InputTypeDefaultDescription
valuestringrequiredUnique value that identifies the item.
disabledbooleanfalsePrevents the item from being highlighted or selected.
valueTextstring | undefined—Text used for typeahead when it differs from the rendered content.
closeOnSelectboolean | undefinedinheritedOverrides the root close-on-select behavior for this item.
insetbooleanfalseAdds leading inset spacing.
variant"default" | "destructive""default"Controls the item's visual treatment.

Outputs

OutputTypeDescription
selectvoidEmits when this item is selected.

<app-menubar-checkbox-item>

Inputs

InputTypeDefaultDescription
valuestringrequiredUnique value that identifies the checkbox item.
checkedboolean | undefined—Checked state when controlled. Supports Angular two-way binding.
disabledbooleanfalsePrevents the item from being highlighted or selected.
valueTextstring | undefined—Text used for typeahead when it differs from the rendered content.
closeOnSelectboolean | undefinedinheritedOverrides the root close-on-select behavior for this item.
insetbooleanfalseAdds leading inset spacing.

Outputs

OutputTypeDescription
checkedChangeboolean | undefinedEmits the updated checked state.

[appMenubarRadioGroup]

Inputs

InputTypeDefaultDescription
idstring | undefinedgeneratedIdentifier shared with the radio group label.
valuestring | null | undefined—Selected radio value. Supports Angular two-way binding.

Outputs

OutputTypeDescription
valueChangestring | null | undefinedEmits the updated selected radio value.
valueChangeDetailsMenuValueChangeDetailsEmits details when the radio value changes.

<app-menubar-radio-item>

InputTypeDefaultDescription
valuestringrequiredUnique value that identifies the radio item.
disabledbooleanfalsePrevents the item from being highlighted or selected.
valueTextstring | undefined—Text used for typeahead when it differs from the rendered content.
closeOnSelectboolean | undefinedinheritedOverrides the root close-on-select behavior for this item.
insetbooleanfalseAdds leading inset spacing.

[appMenubarLabel]

InputTypeDefaultDescription
insetbooleanfalseAdds leading inset spacing.

<app-menubar-sub>

Nested menu root. It accepts the same inputs and emits the same outputs as <app-menubar-menu>.

<div appMenubarSubTrigger>

InputTypeDefaultDescription
insetbooleanfalseAdds leading inset spacing.

[appMenubarItemText]

InputTypeDefaultDescription
valuestring | undefined—Item value used when the directive is outside an item context.
disabledbooleanfalseDisabled state used when the directive is outside an item context.
valueTextstring | undefined—Typeahead text used when the directive is outside an item context.

Context, Providers, and Utilities

ExportAngular API
MenuRootProviderDirective [menu-root-provider] providing an externally created menu API.
MenuContextStructural directive [menu-context] exposing the root API to a template.
MenuItemContextDirectiveStructural directive [menu-item-context] exposing the current item state.
useMenu(options)Creates the signal-backed menu machine inside an Angular injection context.
injectMenuContext()Injects the nearest menu root context.
injectMenuContextCarrier()Injects the context carrier used across portals.
injectMenuItemContext()Injects the nearest menu-item context.
MenubarImportsReadonly collection containing the menubar UI and context helpers.

Types

ExportDescription
MenuApiConnected menu state and actions.
MenuElementIdsOverrides for generated menu part IDs.
MenuMachinePropsConfiguration accepted by the underlying menu machine.
MenuPositioningOptionsFloating-menu positioning and collision options.
MenuSelectionDetailsDetails emitted by select.
MenuHighlightChangeDetailsDetails emitted by highlightChange.
MenuOpenChangeDetailsDetails emitted by openChangeDetails.
MenuTriggerValueChangeDetailsDetails emitted by triggerValueChangeDetails.
MenuFocusOutsideEventEvent emitted by focusOutside.
MenuInteractOutsideEventEvent emitted by interactOutside.
MenuPointerDownOutsideEventEvent emitted by pointerDownOutside.
MenuNavigateDetailsDetails supplied to the navigate input.
MenuValueChangeDetailsDetails emitted when a radio-group value changes.
UseMenuOptionsOptions accepted by useMenu.
UseMenuPropsMenu props supplied by the useMenu context callback.
UseMenuReturnSignal-backed menu machine returned by useMenu.