Skip to Content
BBRICKSv0.7.4
ShellFrame

SidebarUser

The PR portal's .me row: avatar, name, role, and an action at the end (sign out).

import { SidebarUser } 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.

Pinned to TRNDR presetPR theme
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 SidebarUser. Written in docs/content/components/SidebarUser.md; the props above are read from the code, which wins where the two disagree.

The signed-in user's row at the bottom of the sidebar: avatar, name, a role line and an action (sign out) at the end; use it as AppShell's sidebarFooter.

It is the PR mock's .me row ("Mona Adel · PR team" with a sign-out icon). The Brand dashboard puts the user in the header's UserMenu instead. The sidebar hides it on the 72px rail.

Anatomy

  1. Row (.kit-shell-me): flex, gap 10, 12px top padding.
  2. Avatar (avatar): an Avatar (38px, 30px with size="sm"), or sized by avatarSize.
  3. Text (.kit-shell-me-text): name in bold 13px; detail in grey 12px.
  4. Action (action): the sign-out icon button (LogoutButton className="kit-shell-me-out", 44px wide and 36px tall on desktop, 44px tall on touch tiers; grey, white on hover; the icon mirrors in RTL).

Variants

PropsLook
defaultAvatar at its own size.
avatarSize={34}The PR mock's 34px avatar; initials scale with it (--kit-me-av).
no avatarText only (story NoAvatar).
actionSign-out icon at the end.

States

Static row; the action has hover and an inverse focus ring. Long names wrap (min-width: 0).

Usage

<SidebarUser
  avatar={<Avatar name="Mona Adel" seed={1} size="sm" />}
  name="Mona Adel"
  detail="PR team"
  action={
    <LogoutButton className="kit-shell-me-out" onLogout={signOut}>
      <Icon name="logout" /><span className="kit-sr">Sign out</span>
    </LogoutButton>
  }
/>
import { AppShell, Avatar, SidebarUser, type NavGroup, type ShellBrand } from '@ergasti/bricks';

declare const PR_NAV: NavGroup[];
declare const prBrand: ShellBrand;

// As the PR Portal shell's footer
export function PrShell({ children }: { children: React.ReactNode }) {
  return (
    <div data-bricks-theme="pr">
      <AppShell brand={prBrand} nav={PR_NAV} activeId="home"
        sidebarFooter={<SidebarUser avatar={<Avatar name="Mona Adel" seed={1} size="sm" />} name="Mona Adel" detail="PR team" />}>
        {children}
      </AppShell>
    </div>
  );
}

Where it appears

  • PR Portal › every screen › sidebar bottom (gallery/screens/pr/PrScreenFrame.tsx). Screen: PR · Home and the other Pr* pages.

Guidelines

Do

  • Give an icon-only sign-out button screen-reader text ("Sign out").
  • Keep detail to the role or team.

Don't

  • Don't show both this row and a header UserMenu for the same person.
  • Don't put more than one action here.

RTL and Arabic

  • Avatar on the right; the logout arrow mirrors.

Tokens

--kit-me-av (set from avatarSize), --shell-nav-hover (action hover), --focus-ring-inverse; fixed #9A9DA8 for the detail line.

Accessibility

  • Plain text row; the action must have an accessible name (visually hidden text or aria-label).
  • The sign-out button is a real <button> (or a POST form with LogoutButton url); 44 × 36px on desktop, 44 × 44px on touch tiers (≤1024px); inverse focus ring.

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.

See also: NavGroups · useLanguage · Sidebar · Button · Avatar · Switch · Icon · AppShell · BottomNav · BrandMark · MobileNavSheet

Source

src/shell/Sidebar.tsx (line 107) on GitHub.

On this page