Components
Navigation Menu
A site’s navigation: links, and labels that open glass panels of links on hover or click, switching at once between them; works with any router.
Import
import { NavigationMenu, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink } from '@rinzai/zen';Examples
Router
With your router: asChild puts each link's look and wiring on your own Link (a button stands in for one here), and active follows the page.
Showing Everyday
API reference
<NavigationMenu>
A site's navigation: links, and labels that open panels of links below them, on hover (after openDelay; at once while another is open) or with a click or Enter. Escape, a click outside or Tab moving on closes it. Fill it with NavigationMenuItems, each a NavigationMenuLink, or a NavigationMenuTrigger and a NavigationMenuContent. Name it with aria-label when there's more than one nav on the page.
| Prop | Type | Default |
|---|---|---|
closeDelayHow long a panel opened by the pointer stays after it leaves, in ms (time to reach the panel). | number | 200 |
openDelayHow long the pointer rests on a label before its panel opens, in ms. | number | 150 |
<NavigationMenuItem>
One place in the menu: a link, or a label with its panel.
No props of its own; it accepts the props of the element it renders.
<NavigationMenuTrigger>
The label that opens its item's panel; a chevron after it turns over while it's open.
No props of its own; it accepts the props of the element it renders.
<NavigationMenuContent>
The panel: glass, below its label (above it if there's no room), lined up with its start. Lay out its links as you like.
| Prop | Type | Default |
|---|---|---|
align | "center" | "end" | "start" | start |
offsetGap below the label, in px. | number | 8 |
<NavigationMenuLink>
A link: one of the bar's labels at the top, or a row in a panel (with an optional description under its text). active marks the page you're on. With asChild, your router's link instead of an <a>.
| Prop | Type | Default |
|---|---|---|
activeThe page it leads to is the one you're on. | boolean | — |
asChildPut its props on your own link (the single child), e.g. a router's Link. | boolean | — |
descriptionIn a panel, a line under the link's text. | string | — |