Skip to the content

SideBarLayout

SideBarLayout is the two-column page shell: a fixed 200px sidebar and a fluid content area. Below the md viewport breakpoint the sidebar is hidden and the content takes the full width, so you must provide mobile navigation yourself.
Page Layouts

When to use

Use when
  • The main navigation lives in a persistent side column, as in admin apps and dashboards.
  • A hierarchical menu must stay visible on desktop.
Avoid when
  • The page has no side navigation — use DefaultLayout.
  • The primary navigation is a top header — use DefaultLayout with your own header.

Usage

sidebar and content take components (React.ElementType), not JSX; SideBarLayout renders them. The content track is minmax(0, 1fr), so a wide child (a table, a long URL) cannot widen the page past the viewport.

Sidebar
Content
import { SideBarLayout } from '@apollion-dsi/core/layouts/side-bar-layout';

const Sidebar = () => <nav aria-label="Main">…</nav>;
const Page = () => <main>…</main>;

<SideBarLayout layoutComponents={{ sidebar: Sidebar, content: Page }} />;

The sidebar width is fixed; no prop resizes it.

Mobile navigation

Below md the sidebar wrapper is display: none. It stays in the server HTML, so there is no layout shift after hydration, but it is hidden from assistive technology too. Render a menu button inside content (or your header) that opens a side Sheet — SideBarLayout does not mount one.

Accessibility

  • The layout renders plain <div> elements with no landmark roles. Render <nav> in your sidebar component and <main> in your content component.
  • Give the <nav> an aria-label when the page has more than one navigation landmark.

Properties

See also