Menubar
Free · MITHeadless, accessible, and styled entirely through the attribute surface below — bring your own CSS system, or start from the reference theme.
Install
Without a flag you get no styling at all — plain HTML carrying the attribute surface below. --theme copies the same theme in two dialects;--bridge lumos re-points either one onto Lumos for Astro's tokens (it needs a theme to re-point, and Lumos itself, already in your project).
Unstyled — behavior only, you write the CSS
npx astrocraft-ui add overlays/menubarPlain-CSS theme — no build step
npx astrocraft-ui add overlays/menubar --theme cssTailwind theme — needs Tailwind v4
npx astrocraft-ui add overlays/menubar --theme tailwindPlain-CSS theme, re-pointed onto Lumos tokens
npx astrocraft-ui add overlays/menubar --theme css --bridge lumosTailwind theme, re-pointed onto Lumos tokens
npx astrocraft-ui add overlays/menubar --theme tailwind --bridge lumosLive demo
Menubar & SubMenu
Open one menu and then move the pointer sideways — the bar follows without a click. From the keyboard, ←/→ walk the bar even from inside an open menu, ↓opens one, and on Export as, → steps into the submenu and ← steps back out. The submenu does not close its parent, and light dismiss closes both at once.
Attribute surface
With no class-merging machinery, these attributes are the whole extension point. State is a data-attribute or a native attribute; visibility is the hiddenattribute. Generated from source by pnpm slots.
| Component | Slots | Variants | Runtime state | Native state |
|---|---|---|---|---|
| `Menubar.astro` | `menubar` | — | — | — |
| `MenubarContent.astro` | `menubar-content` | `data-side`: `bottom` · `top` · `left` · `right` `data-align`: `start` · `center` · `end` | — | — |
| `MenubarMenu.astro` | `menubar-menu` | — | — | — |
| `MenubarTrigger.astro` | `menubar-trigger` | — | — | `[aria-expanded]` |
Source
What the command copies — 5 files, alias-free so the copy lands standing alone. This is the whole component, shown without its comments; the files you install keep them, with the reasoning behind every rule.
---
import type { HTMLAttributes } from "astro/types";
type Props = HTMLAttributes<"div">;
const { class: className, ...rest } = Astro.props;
---
<div role="menubar" class={className} data-slot="menubar" {...rest}>
<slot />
</div>
<script>
import "../../_menu";
</script>
---
import "../../../../styles/structure.css";
import type { HTMLAttributes } from "astro/types";
type Props = HTMLAttributes<"div"> & {
id: string;
side?: "bottom" | "top" | "left" | "right";
align?: "start" | "center" | "end";
offset?: number;
};
const { side = "bottom", align = "start", offset, class: className, ...rest } = Astro.props;
---
<div
popover="auto"
role="menu"
data-slot="menubar-content"
data-anchor
data-side={side}
data-align={align}
data-offset={offset}
class={className}
{...rest}
>
<slot />
</div>
---
import type { HTMLAttributes } from "astro/types";
type Props = HTMLAttributes<"div">;
const { class: className, ...rest } = Astro.props;
---
<div role="none" class={className} data-slot="menubar-menu" {...rest}>
<slot />
</div>
---
import type { HTMLAttributes } from "astro/types";
type Props = HTMLAttributes<"button"> & { for: string };
const { for: target, class: className, ...rest } = Astro.props;
---
<button
type="button"
popovertarget={target}
role="menuitem"
aria-haspopup="menu"
aria-expanded="false"
data-slot="menubar-trigger"
class={className}
{...rest}
>
<slot />
</button>
import Menubar from "./Menubar.astro";
import MenubarContent from "./MenubarContent.astro";
import MenubarMenu from "./MenubarMenu.astro";
import MenubarTrigger from "./MenubarTrigger.astro";
export { Menubar, MenubarContent, MenubarMenu, MenubarTrigger };
export default Menubar;
What you get
The component source, copied into your project by npx astrocraft-ui add overlays/menubar — no package dependency, no CSS to fight. Whatever the paid blocks compose, this is it.