Menubar
Horizontal application menu bar with link and button items.
Preview
A live, theme-aware example rendered with the published component.
Import
Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.
tsximport { Menubar } from "@tavojs/ui/menubar";Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/menubar.
When to use
Use it when
Choose something else when
Examples
Menubar example
tsximport { Menubar } from "@tavojs/ui/menubar";
export function MenubarExample1() {
return (
<>
<Menubar />
</>
);
}Common props and defaults
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
items | Array | — | Navigation items when supported by the component. Applies to Menubar. |
aria-label | string | — | Accessible label for navigation landmarks when needed. Applies to Menubar. |
children | Child | — | Navigation content or custom item structure. Applies to Menubar. |
Complete TypeScript API
Import from @tavojs/ui/menubar. Published exports: Menubar, MenubarItem, MenubarItemProps, MenubarProps, MenubarRoot.
MenubarProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Navigation content or custom item structure. Applies to Menubar. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by Menubar. |
id | string | No | Inherited id attribute accepted by Menubar. |
role | string | No | Inherited role attribute accepted by Menubar. |
style | Record<string, unknown> | No | Inherited style attribute accepted by Menubar. |
title | string | No | Inherited title attribute accepted by Menubar. |
tabIndex | number | No | Inherited tabIndex attribute accepted by Menubar. |
hidden | boolean | No | Inherited hidden attribute accepted by Menubar. |
disabled | boolean | No | Inherited disabled attribute accepted by Menubar. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by Menubar. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by Menubar. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by Menubar. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by Menubar. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by Menubar. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by Menubar. |
MenubarItemProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Navigation content or custom item structure. Applies to Menubar. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by Menubar. |
id | string | No | Inherited id attribute accepted by Menubar. |
role | string | No | Inherited role attribute accepted by Menubar. |
style | Record<string, unknown> | No | Inherited style attribute accepted by Menubar. |
title | string | No | Inherited title attribute accepted by Menubar. |
tabIndex | number | No | Inherited tabIndex attribute accepted by Menubar. |
hidden | boolean | No | Inherited hidden attribute accepted by Menubar. |
disabled | boolean | No | Inherited disabled attribute accepted by Menubar. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by Menubar. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by Menubar. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by Menubar. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by Menubar. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by Menubar. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by Menubar. |
href | string | No | Inherited href attribute accepted by Menubar. |
current | boolean | No | Inherited current attribute accepted by Menubar. |
State ownership and DOM target
| Concern | Contract |
|---|---|
| State | No component state contract is exposed; the application owns the rendered content and surrounding behavior. |
| DOM target | Public passthrough props target the component root. Treat nested elements and private class names as implementation details. |
Anatomy and related components
This component exposes one public component root rather than a compound member API.
Limitations
Avoid Menubar when for arbitrary button groups that do not navigate.
Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.
Accessibility
Navigation components should expose current-page state and landmark labels when context is not obvious.
Use aria-current for active destinations where supported.
Add aria-label when multiple nav landmarks exist.
Keep link text descriptive.
Component status
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | navigation |
| Component import | @tavojs/ui/menubar |
| Explicit CSS import | @tavojs/ui/css/menubar |
| Preview | Interactive preview available on this page |