BottomNav
The phone tab bar (<860px): a few destinations + More. No count badges (the sheet has them); no JS motion.
import { BottomNav } from '@ergasti/bricks';Examples
Phone tab bar
A few primary destinations and a "More" button that opens MobileNavSheet. It is fixed to the bottom of the screen, so this frame is contained.
Code
import { useState } from 'react';
import { BottomNav } from '@ergasti/bricks';
import { brandNav } from './nav';
function Tabs() {
const [active, setActive] = useState('home');
const [more, setMore] = useState(false);
return (
<>
<p className="kit-muted">More sheet: {more ? 'open' : 'closed'}</p>
<BottomNav items={brandNav[0].items.slice(0, 4)} activeId={active} onSelect={(item) => setActive(item.id)} onMore={() => setMore(!more)} moreOpen={more} />
</>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses BottomNav. Written in docs/content/components/BottomNav.md; the props above are read from the code, which wins where the two disagree.
The phone tab bar (under 860px): up to four destinations with icon and label, plus "More" that opens the nav sheet; AppShell renders it on phones, so use it directly only in a custom frame.
The v3 mocks are desktop layouts; the library adds this tier (decision Q4) so the brand's most used screens stay one tap away on a phone. It shows no count badges (the sheet has them) and uses no JS motion.
Anatomy
- Bar (
.kit-shell-tabbar,<nav>): fixed to the bottom,--bottom-nav-height(64px) plus the safe-area inset,--cardfill, top border. - Tab (
.kit-shell-tab): 20px icon over an 11px label, min 52px tall, radius 14; the current tab on--rasp-50with--rasp-dink. - More (with
onMore): ellipsis icon and "More"; reads as current while the sheet is open.
Variants
| Props | Look |
|---|---|
onMore set | Four tabs + More (default in AppShell). |
no onMore | Tabs only. |
AppShell bottomNavIds | Pick which items become tabs (default: the first four enabled items with an icon). |
States
| State | How |
|---|---|
| Current | activeId matches and moreOpen is false: aria-current="page". |
| More open | moreOpen: More is current, no tab is. |
| Disabled | NavItem.disabled. |
| Focus-visible | Focus ring. |
Usage
// Usually automatic
<AppShell nav={nav} activeId="home" brand={brand} bottomNavIds={['home', 'creators', 'coupons', 'payments']}>…</AppShell>import { useState } from 'react';
import { BottomNav, MobileNavSheet, flattenNav, type NavGroup, type NavItem, type ShellBrand } from '@ergasti/bricks';
declare const nav: NavGroup[];
declare const brand: ShellBrand;
// Directly, in a custom frame
export function PhoneNav({ go }: { go: (item: NavItem) => void }) {
const [sheetOpen, setSheetOpen] = useState(false);
const tabs = flattenNav(nav).filter((i) => ['home', 'creators', 'coupons', 'payments'].includes(i.id));
return (
<>
<BottomNav items={tabs} activeId="home" onSelect={go} onMore={() => setSheetOpen(true)} moreOpen={sheetOpen} />
<MobileNavSheet open={sheetOpen} onClose={() => setSheetOpen(false)} brand={brand} groups={nav} activeId="home" onSelect={go} />
</>
);
}Where it appears
- Brand dashboard and PR Portal on phones (< 860px), at the bottom of every screen (not in the desktop mocks).
AppShellstoryPhone.
Guidelines
Do
- Choose the four destinations used most (Home, Creators, Coupons, Payments).
- Keep labels to one short word.
Don't
- Don't put more than four items plus More.
- Don't add counts or badges here.
RTL and Arabic
- Tab order runs right to left; labels use the Arabic nav labels.
Tokens
--bottom-nav-height, --card, --line, --ink-2, --rasp-50, --rasp-d, --focus-ring.
Accessibility
<nav aria-label="Bottom navigation">; tabs are<a>or<button>witharia-current="page".- More has
aria-haspopup="dialog"andaria-expanded. - Tabs are at least 44px wide and 52px tall; the bar respects the safe-area inset.
Found in the source
- ARIA attributes set:
aria-label,aria-current,aria-haspopup,aria-expanded,aria-hidden. - Its tests cover: “tabs are plain buttons with no JS motion, reachable with Tab and Enter”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
MobileNavSheet: opened by More.AppShell: renders both on phones.NavGroups: the full nav in the sheet.
See also: useLanguage · BrandMark
Source
src/shell/BottomNav.tsx (line 26) on GitHub.