A visually persistent menu that provides quick access to a consistent set of commands.
Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
Menubar └── MenubarMenu ├── MenubarTrigger └── MenubarContent ├── MenubarLabel (optional) ├── MenubarGroup (optional) │ └── MenubarItem | MenubarCheckboxItem | MenubarRadioItem ├── MenubarRadioGroup (optional) ├── MenubarSeparator (optional) └── MenubarSub (optional) ├── MenubarSubTrigger └── MenubarSubContent
Examples
Checkbox
Loading...
Default
Loading...
Radio
Loading...
With Icons
Loading...
API Reference
Menubar
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
defaultHighlightedValue | string | null | undefined | — | Configures default highlighted value. |
highlightedValue | string | null | undefined | — | Configures highlighted value. |
onHighlightChange | ((details: HighlightChangeDetails) => void) | undefined | — | Runs when highlight changes. |
onSelect | ((details: SelectionDetails) => void) | undefined | — | Runs when select changes. |
anchorPoint | Point | null | undefined | — | Configures anchor point. |
loopFocus | boolean | undefined | — | Configures loop focus. |
positioning | PositioningOptions | undefined | — | Configures floating-element placement and collision handling. |
closeOnSelect | boolean | undefined | true | Configures close on select. |
open | boolean | undefined | — | Whether the component is open when controlled. |
onOpenChange | ((details: OpenChangeDetails) => void) | undefined | — | Runs when open changes. |
defaultOpen | boolean | undefined | — | Initial open state when uncontrolled. |
typeahead | boolean | undefined | — | Configures typeahead. |
composite | boolean | undefined | — | Configures composite. |
navigate | ((details: NavigateDetails) => void) | null | undefined | — | Configures navigate. |
triggerValue | string | null | undefined | — | Configures trigger value. |
defaultTriggerValue | string | null | undefined | — | Configures default trigger value. |
onTriggerValueChange | ((details: TriggerValueChangeDetails) => void) | undefined | — | Runs when trigger value changes. |
Context, Hooks, and Types
| Export | API |
|---|---|
MenubarContext | Render-prop component that exposes component state and actions. |
MenubarRootProvider | Provides an externally created API to the component tree. |
useMenu | Creates or accesses the component API. |
useMenuContext | Returns the nearest component API. |
Angular
React
Solid
Svelte
Vue