NavBar
NavBar is the bottom navigation bar of a phone or tablet shell: three to five top-level destinations, each a glyph
over a short label. The current item is tinted and marked aria-current="page". The bar pads its bottom by
env(safe-area-inset-bottom) to clear the home indicator.Navigation
When to use
Use when
- You link the app's three to five top-level sections on a phone or an upright tablet.
- Each destination is a page (a route).
- You pair it with a
Tabsrow inmode="nav"for the pages inside a section.
Avoid when
- There are more than five destinations — keep four and move the rest behind a "More"
Sheet. - The viewport is wide — hand navigation to a side rail and stop rendering the bar from
mdup. - The items are actions (save, share) or switch content in place — use buttons or content-mode
Tabs.
Usage
Derive current from the router's pathname. A development warning fires outside the three-to-five range. Click an
item below (the demo keeps current in state instead of navigating).
import { NavBar } from '@apollion-dsi/core/elements/nav-bar';
import { clock, cog, desktop, search } from '@apollion-dsi/core/icons';
<NavBar
aria-label="Main"
items={[
{ label: 'Overview', icon: desktop, href: '/', current: pathname === '/' },
{ label: 'Search', icon: search, href: '/search', current: pathname === '/search' },
{ label: 'Activity', icon: clock, href: '/activity', current: pathname === '/activity' },
{ label: 'Settings', icon: cog, href: '/settings', current: pathname === '/settings' },
]}
/>;Routing
Items with href or to render as links — a native <a> by default. Pass the router's link component once as
linkAs, or per item as as. An item with only onClick renders a <button type="button">.
import NextLink from 'next/link';
<NavBar aria-label="Main" linkAs={NextLink} items={items} />;Placement
The bar is in flow by default, so the shell places it (the last grid row, a sticky footer). fixed pins it to the
bottom of the viewport on the sticky z-index layer; reserve the same space at the end of the scrolling content. The
safe-area inset applies only when the page's viewport meta includes viewport-fit=cover.
Accessibility
- A
navlandmark named by the requiredaria-label; give eachnavon the page its own name. - Items are a list of links or buttons named by their visible label; the glyph is
aria-hidden. - The current item is marked by more than color: a bold label and a wash behind its glyph.
- Every item is at least 56px tall and shows an inset
:focus-visiblering.
Properties
Name
Type
Default
Description
aria-label *stringnoneAccessible name of the `nav` landmark. Required: a shell usually carries
more than one `nav` (bar + section row), and each needs its own name.
color"primary""secondary""tertiary""success""warning""danger""neutral"'primary'Palette that tints the current item.
fixedbooleanfalsePins the bar to the bottom of the viewport (`position: fixed`, sticky
z-index layer). Leave it off when the shell places the bar itself (a grid
row, a sticky footer).
items *NavBarItem[]noneThe destinations — 3 to 5 (a development warning fires outside that range).
linkAsElementType<any, keyof IntrinsicElements>'a'Link component for every item with `href` / `to` (`NextLink`,
`RouterLink`, …). An item's own `as` wins.