Sidebar
The mock's .side: brand, nav, card, footer. Positioned by shell.css: fixed to the viewport with top and bottom edges (not sticky, not 100vh), so it never rides up at the end of a long page and its bottom is never cut off by a phone browser's toolbar; it scrolls on its own when the window is short.
import { Sidebar } from '@ergasti/bricks';Examples
The sidebar by itself
Brand block, grouped navigation (a group can collapse), a card slot and a footer slot. collapsed turns it into the 72px icon rail.
Code
import { useState } from 'react';
import { Avatar, Button, Sidebar, SidebarCard, SidebarUser, useLanguage } from '@ergasti/bricks';
import { brandMark, brandNav } from './nav';
function Expanded() {
const language = useLanguage();
const [active, setActive] = useState('creators');
return (
<div style={{ position: 'relative', height: 580 }}>
<Sidebar
brand={brandMark}
groups={brandNav}
activeId={active}
onSelect={(item) => setActive(item.id)}
card={<SidebarCard title={language === 'ar' ? 'محتاج مساعدة؟' : 'Need a hand?'} action={<Button size="sm">Contact TRNDR</Button>}>Your account manager handles approvals.</SidebarCard>}
footer={<SidebarUser avatar={<Avatar name="Mona Adel" seed={0} size="sm" />} name="Mona Adel" detail="PR team" />}
/>
</div>
);
}Icon rail
Code
import { useState } from 'react';
import { Sidebar } from '@ergasti/bricks';
import { brandMark, brandNav } from './nav';
function Rail() {
const [active, setActive] = useState('home');
return (
<div style={{ position: 'relative', height: 580 }}>
<Sidebar brand={brandMark} groups={brandNav} activeId={active} onSelect={(item) => setActive(item.id)} collapsed />
</div>
);
}PR portal sidebar parts
A Switch in the sidebar is the PR mock's small dark switch (41 × 25, #3A3C45 off track) with no prop: the sidebar sets it. SidebarUser with avatarSize={34} draws the mock's 34px avatar, and the logout icon is its sign-out arrow.
Code
import { useState } from 'react';
import { Avatar, Button, Icon, Sidebar, SidebarCard, SidebarUser, Switch } from '@ergasti/bricks';
import { brandMark, brandNav } from './nav';
function PrParts() {
const [active, setActive] = useState('creators');
const [tags, setTags] = useState(false);
return (
<div style={{ position: 'relative', height: 580 }}>
<Sidebar
brand={brandMark}
groups={brandNav}
activeId={active}
onSelect={(item) => setActive(item.id)}
card={<SidebarCard title="Open decisions"><span style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginTop: 8 }}><label htmlFor="docs-tags">Show decision tags</label><Switch id="docs-tags" label="Show decision tags" checked={tags} onChange={setTags} /></span></SidebarCard>}
footer={<SidebarUser avatar={<Avatar name="Mona Adel" seed={7} />} avatarSize={34} name="Mona Adel" detail="PR team" action={<Button size="sm" variant="ghost" aria-label="Sign out"><Icon name="logout" /></Button>} />}
/>
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses Sidebar. Written in docs/content/components/Sidebar.md; the props above are read from the code, which wins where the two disagree.
The dark navigation sidebar: brand block, nav groups, an optional help card and a user row; AppShell renders it for you, so use it directly only in a custom frame.
It is both mocks' .side: a fixed dark column (252px; 248px in the PR theme) pinned to the viewport's top and bottom edges, so it never rides up at the end of a long page and its bottom is never cut off by a phone browser's toolbar; it scrolls on its own when the window is short. With collapsed it is the tablet tier's 72px icon rail.
Anatomy
- Brand (
.kit-shell-brand): a 38px raspberry square mark (radius 12, the first letter oflabelby default), the name (display face 16px 800, "TRNDR.HushUp" with a lime dot) and the tagline (12px grey, "Brand dashboard"). - Nav (
.kit-shell-nav):NavGroups(items 14px, 11px × 14px padding, radius 14; active item raspberry). - Card (
card):SidebarCard("Need a hand?" + lime "Contact TRNDR"; PR:DecisionsCard). - Footer (
footer):SidebarUser(PR: Mona Adel, PR team, sign-out icon). - Toggle (rail tier, with
onToggleCollapse): a panel icon button at the end.
Variants
| Prop | Look | Use when |
|---|---|---|
| default | Full 252px column | Desktop (> 1024px). |
collapsed | 72px rail: mark and icons only; counts become dots, headings become short rules, items without icons show initials; card and footer hidden | Tablet (860–1024px). |
collapsed={false} + overlay | Expanded rail floating over the content with a drawer shadow | The rail's expanded state. |
PR theme (data-bricks-theme="pr") | 248px, ink background, PR nav colours | PR Portal. |
States
| State | How |
|---|---|
| Active item | activeId: raspberry fill, aria-current="page". |
| Hover | Item background --shell-nav-hover. |
| Disabled item | NavItem.disabled: muted, not focusable ("LATER"). |
| Short window | The aside scrolls on its own (overscroll-behavior: contain). |
Types
ShellBrand (brand): { mark?, name, label, tagline? }.
Usage
// Usually through AppShell
<AppShell brand={brand} nav={nav} activeId="creators" sidebarCard={card} sidebarFooter={user}>…</AppShell>// Directly, in a custom frame
<Sidebar
brand={{ name: <>TRNDR<span className="kit-shell-accent">.</span>HushUp</>, label: 'TRNDR.HushUp', tagline: 'Brand dashboard' }}
groups={BRAND_NAV}
activeId="creators"
onSelect={(item) => navigate(`/${item.id}`)}
card={<SidebarCard title="Need a hand?" action={<Button size="sm">Contact TRNDR</Button>}>Your TRNDR account manager handles approvals, coupons and payouts for you.</SidebarCard>}
/>Where it appears
- Brand › every screen › left sidebar (Home, Find creators NEW, Creators 304, Coupons 304, Motivation 2, Payments, Analytics, Activity log, Settings) with "Need a hand?". Screens: all
Brand*pages. The collapsible "More" group (Videos, Messages, Fraud checks, Brand library) in the stories is the library's console nav, not in the v3 mock. - PR Portal › every screen › sidebar (Home, Approvals 7, Brands, the "Campaigns" heading with Affiliate programs / Challenges, Creators, Tiers, Messages, Activity log, "Next sprint" LATER items) with the decisions card and Mona Adel's row. Screens: all
Pr*pages.
Guidelines
Do
- Keep counts to waiting work; mark only late work
hot. - Keep one card at most, below the nav.
- Give the brand a plain-text
label(used by the rail's tooltip and the sheet).
Don't
- Don't put it inside a scrolling container: it is fixed to the viewport.
- Don't add a second nav or tabs inside the sidebar.
RTL and Arabic
- The column sits on the right edge in Arabic; the toggle's panel glyph mirrors.
- Group headings drop uppercase and letter-spacing in Arabic.
Tokens
--sidebar-width-desktop, --sidebar-width-rail, --shell-side-bg (--color-sidebar), --shell-side-ink, --shell-top-offset, --shell-nav-ink, --shell-nav-hover, --shell-nav-active, --rasp (mark), --focus-ring-inverse, --shadow-drawer, --font-family-display.
Accessibility
<nav aria-label="Sidebar navigation">(override withcopy.sidebar).- Rail: the brand name stays as screen-reader text; items get
aria-label(with the count) and tooltips. - Toggle:
aria-expandedand "Expand sidebar" / "Collapse sidebar". - Inverse focus ring on the dark background. Items are about 42px tall on desktop (about 40px in the PR theme); the 44px minimum applies on touch tiers (≤1024px), i.e. the rail.
Found in the source
- ARIA attributes set:
aria-label,aria-hidden,aria-expanded.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
AppShell: renders it per tier.NavGroups: the list inside.SidebarCard,SidebarUser: its card and footer.MobileNavSheet: the phone equivalent.
See also: useLanguage · Button · Avatar · Switch · Icon · BottomNav · BrandMark
Source
src/shell/Sidebar.tsx (line 37) on GitHub.