Skip to main content
Pricing

Sidebar

Free

A vertical navigation panel positioned along the left edge of the layout. Contains grouped navigation links organised into collapsible sections, with optional icons beside each label. Supports a pinned/collapsed state that shrinks to icon-only mode, freeing horizontal space for content.

6 variants

Dashboard
Settings
Users
Reports

Variants

VariantDescriptionWhen to use
ExpandedFull-width sidebar showing icons and text labels for all items.Use as the default state on desktop viewports with sufficient horizontal space.
CollapsedIcon-only sidebar with tooltip labels on hover.Use when the user pins the sidebar closed or on narrower desktop screens.
With Sections

Usage Guidelines

Do

Wrap the sidebar in <nav aria-label="Sidebar"> to create a distinct landmark.

Don't

Nest more than two levels of navigation — flatten the hierarchy instead.

Do

Use aria-expanded on collapsible group headings to communicate open/closed state.

Don't

Remove text labels in expanded mode — icons alone are not sufficient for primary nav.

Do

Highlight the current page link with aria-current="page".

Don't

Auto-collapse the sidebar without providing a way to re-expand it.

Do

Provide a toggle button with aria-label="Collapse sidebar" / "Expand sidebar".

Don't

Use the sidebar for actions — it is for navigation only.

Code

HTML
<nav class="lex-sidebar" aria-label="Sidebar">
  <div class="lex-sidebar__group">
    <button class="lex-sidebar__group-header" aria-expanded="true">
  ...
CSS Custom Properties
.lex-sidebar {
  width: var(--lex-sidebar-width, 260px);
  height: 100vh;
  background: var(--lex-bg-surface-subtle);
  ...
React
// Using Lexicon CSS classes with React

<Sidebar>
  <SidebarGroup label="Dashboard" defaultOpen>
  ...

Design Tokens

TokenValue (dark)Value (light)CSS property
--lex-sidebar-widthwidth
--lex-sidebar-bgbg
--lex-sidebar-borderborder
--lex-sidebar-item-paddingpadding
--lex-sidebar-item-active-bgbg

Accessibility

  • Use <nav aria-label="Sidebar"> to distinguish from other nav landmarks on the page.
  • Collapsible section headings must toggle aria-expanded between "true" and "false".
  • Current page link uses aria-current="page" for screen reader context.
  • Collapsed icon-only mode must surface text labels via tooltips or aria-label on each link.
  • Overlay sidebar on mobile should trap focus while open and return focus to the trigger on close.

Keyboard Interactions

TabMoves focus through sidebar links and group headers in DOM order.
Enter/SpaceActivates the focused link or toggles a collapsible group.
EscapeCloses the overlay sidebar on mobile and returns focus to the trigger.