Nav

Navigation primitives for building sidebars and menus.

NavItem basic

A standalone navigation item rendered as a <button> by default.

<NavItem label="Dashboard" />

NavItem with icon

Pass any React node to icon to render it to the left of the label.

<NavItem
label="Settings"
icon={<svg …>…</svg>}
/>

NavItem active

Set active to apply the highlighted style indicating the current page.

<NavItem label="Dashboard" />
<NavItem label="Components" active />
<NavItem label="Patterns" />

NavItem disabled

Set disabled to prevent interaction and apply muted styles.

<NavItem label="Available" />
<NavItem label="Coming soon" disabled />

NavItem as link

Provide href to render an <a> tag instead of a <button>.

<NavItem label="Documentation" href="/docs" />

NavGroup

NavGroup renders a labelled section heading above its NavItem children.

<NavGroup label="Getting Started">
<NavItem label="Introduction" href="/docs/getting-started/introduction" />
<NavItem label="Installation" href="/docs/getting-started/installation" />
</NavGroup>

NavGroup collapsible

Set collapsible to allow the group to be toggled open or closed. Use defaultCollapsed to start collapsed.

<NavGroup label="Components" collapsible>
<NavItem label="Button" href="/docs/components/button" />
<NavItem label="Card" href="/docs/components/card" />
<NavItem label="Badge" href="/docs/components/badge" />
</NavGroup>

// Start collapsed:
<NavGroup label="Components" collapsible defaultCollapsed>
…
</NavGroup>

Props

NavItem

PropTypeDefaultDescription
labelstringText label for the nav item
iconReactNodeIcon rendered to the left of the label
hrefstringRenders as <a> when provided, otherwise <button>
activebooleanfalseApplies highlighted styles for the current page
disabledbooleanfalsePrevents interaction and applies muted styles
onClickMouseEventHandlerClick handler

NavGroup

PropTypeDefaultDescription
labelstringSection heading text
collapsiblebooleanfalseAllows the group to be toggled open or closed
defaultCollapsedbooleanfalseWhen collapsible, starts the group in a collapsed state
childrenReactNodeNavItem elements