Components

Menubar

A menu bar providing commands and options for your application.

Anatomy#

Import the component and assemble its parts:

Anatomytsx
import { Menubar } from '@egoist/solid-base/menubar';
import { Menu } from '@egoist/solid-base/menu';

<Menubar>
  <Menu.Root>
    <Menu.Trigger />
    <Menu.Portal>
      <Menu.Backdrop />
      <Menu.Positioner>
        <Menu.Popup>
          <Menu.Arrow />
          <Menu.Item />
          <Menu.LinkItem />
          <Menu.Separator />

          <Menu.SubmenuRoot>
            <Menu.SubmenuTrigger />
          </Menu.SubmenuRoot>

          <Menu.Group>
            <Menu.GroupLabel />
          </Menu.Group>

          <Menu.RadioGroup>
            <Menu.RadioItem>
              <Menu.RadioItemIndicator />
            </Menu.RadioItem>
          </Menu.RadioGroup>

          <Menu.CheckboxItem>
            <Menu.CheckboxItemIndicator />
          </Menu.CheckboxItem>

          <Menu.Viewport />
        </Menu.Popup>
      </Menu.Positioner>
    </Menu.Portal>
  </Menu.Root>
</Menubar>;

Each menu in the bar is a regular Menu: every part and example on that page applies here. Once one menu is open, hovering or pressing the arrow keys moves to the neighboring menus.

API reference#

<Menubar>

The container for menus.

PropTypeDefault
modalbooleantrue

Whether the menubar is modal.

disabledbooleanfalse

Whether the whole menubar is disabled.

orientationMenuRoot.Orientation'horizontal'

The orientation of the menubar.

loopFocusbooleantrue

Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys.

classstring | ClassValue | ((state: State) => ClassValue)—

CSS class applied to the element, or a function that returns a class based on the component's state.

styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—

Style applied to the element, or a function that returns a style based on the component's state.

renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—

Allows you to replace the component's HTML element with a different tag, or compose it with another component.

Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.

Data attributeDescription
data-modal

Present when the corresponding menubar is modal.

data-orientation

Determines the orientation of the menubar.

data-has-submenu-open

Present when any submenu within the menubar is open.