Install
Pull Navigation Menu from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { NavigationMenu } from "@brika/clay";import { NavigationMenu } from "@brika/clay/components/navigation-menu";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
navigationMenuTriggerStyle,
} from '@brika/clay/components/navigation-menu';
/** Flyout navigation with two trigger menus and a plain link. */
export default function NavigationMenuDefaultDemo() {
return (
<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger>Getting started</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid gap-2 p-4 w-64">
<li>
<NavigationMenuLink asChild>
<a href="https://example.com" className="flex flex-col gap-1 rounded-md p-3 text-sm hover:bg-accent">
<span className="font-medium">Introduction</span>
<span className="text-muted-foreground text-xs">Install and configure Clay.</span>
</a>
</NavigationMenuLink>
</li>
<li>
<NavigationMenuLink asChild>
<a href="https://example.com" className="flex flex-col gap-1 rounded-md p-3 text-sm hover:bg-accent">
<span className="font-medium">Theming</span>
<span className="text-muted-foreground text-xs">Customize your design tokens.</span>
</a>
</NavigationMenuLink>
</li>
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuTrigger>Components</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid gap-2 p-4 w-64">
<li>
<NavigationMenuLink asChild>
<a href="https://example.com" className="flex flex-col gap-1 rounded-md p-3 text-sm hover:bg-accent">
<span className="font-medium">Button</span>
<span className="text-muted-foreground text-xs">Interactive action surfaces.</span>
</a>
</NavigationMenuLink>
</li>
<li>
<NavigationMenuLink asChild>
<a href="https://example.com" className="flex flex-col gap-1 rounded-md p-3 text-sm hover:bg-accent">
<span className="font-medium">Dialog</span>
<span className="text-muted-foreground text-xs">Modal overlays for focused tasks.</span>
</a>
</NavigationMenuLink>
</li>
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuLink asChild>
<a href="https://example.com" className={navigationMenuTriggerStyle()}>Changelog</a>
</NavigationMenuLink>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>
);
}Navigation Menu, every way
Accessibility
- Arrow keys move between top-level items; Enter/Space opens flyout panels.
- Active link state is indicated via
data-active; ensurearia-current="page"is also set for AT. - Flyout panels are dismissed by moving focus outside or pressing Escape.
- Use
NavigationMenuLinkwithasChildfor router-link integration.
Theme tokens
Every CSS variable Navigation Menu reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Navigation Menu
without touching component code.
Navigation Menu tokens
16 tokens--navigation-menu-containercolorvar(--background)components.navigationMenu.containerResting background of the navigation-menu trigger.
--navigation-menu-focus-containercolorvar(--accent)components.navigationMenu.focusContainerBackground of the navigation-menu trigger under hover / focus. Active and open states use this color at 50% opacity.
--navigation-menu-focus-labelcolorvar(--accent-foreground)components.navigationMenu.focusLabelForeground color of the navigation-menu trigger under hover / focus.
--navigation-menu-indicator-colorcolorvar(--border)components.navigationMenu.indicatorColorColor of the navigation-menu indicator arrow shown beneath the active trigger.
--navigation-menu-radiusradiusvar(--radius-control)components.navigationMenu.radiusNavigation menu trigger corner radius.
--navigation-menu-heightsize2.25remcomponents.navigationMenu.heightDefault navigation-menu height.
--navigation-menu-padding-xsizecalc(var(--spacing) * 4)components.navigationMenu.paddingXInline padding inside the navigation-menu.
--navigation-menu-padding-ysizecalc(var(--spacing) * 2)components.navigationMenu.paddingYBlock padding inside the navigation-menu.
--navigation-menu-font-familyfont-familyvar(--font-sans)components.navigationMenu.fontFamilyTypeface for navigation-menu.
--navigation-menu-font-sizefont-sizevar(--text-body-md)components.navigationMenu.fontSizeFont size for navigation-menu.
--navigation-menu-font-weightfont-weight500components.navigationMenu.fontWeightFont weight for navigation-menu.
--navigation-menu-line-heightline-height1.25components.navigationMenu.lineHeightLine height for navigation-menu.
--navigation-menu-letter-spacingletter-spacing0components.navigationMenu.letterSpacingLetter spacing for navigation-menu. Useful for caps labels.
--navigation-menu-text-transformtext-transformnonecomponents.navigationMenu.textTransformText transform for navigation-menu (`uppercase`, `lowercase`, `capitalize`, `none`).
--navigation-menu-durationdurationvar(--motion-standard-duration)components.navigationMenu.durationTransition duration for navigation-menu state changes.
--navigation-menu-easingeasingvar(--motion-standard-easing)components.navigationMenu.easingTransition easing for navigation-menu state changes.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.navigationMenu, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"navigationMenu": {
"paddingX": "calc(var(--spacing) * 4)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-navigation-menu-…) — see the
chips on each token row.
API reference
Props specific to Navigation Menu. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<NavigationMenu />
1 prop- viewportdefault
truebooleanWhentrue(default), renders aNavigationMenuViewportat the root for flyout panels.
<NavigationMenuContent />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<NavigationMenuIndicator />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<NavigationMenuItem />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<NavigationMenuLink />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<NavigationMenuList />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<NavigationMenuTrigger />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<NavigationMenuViewport />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.