Skip to main content
  1. Docs
  2. Components
  3. Console frame

Sidebar

A console's navigation: links only, in groups, one level of nesting, every item in the Tab order.

Import
@qeetrix/react/experimental
Status
ExperimentalSince 0.0.4
Renders
<nav>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

sidebar.tsx
// Experimental: from the package's experimental entry, until it's stable.
import { Sidebar, SidebarGroup, SidebarItem } from "@qeetrix/react/experimental";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
labelstringrequiredNames the navigation landmark: "Qeet ID".
titleReactNode—The area's heading: "Identity".
filterbooleanfalse"Filter navigation": narrows the items as you type.
footerReactNode—Below the items: help, what's new.
SidebarGroup: labelReactNode—Without one, space alone separates it.
SidebarItem: labelstringrequiredThe text; in the rail, the tooltip.
SidebarItem: href · renderstring · ReactElement—Where it goes; a router link.
SidebarItem: icon · filledWhenCurrentIconSource · boolean— · trueA 16px round icon, filled while current; false keeps the outline. An icon with no filled drawing keeps its outline.
SidebarItem: currentbooleanfalsearia-current="page" and the Ember bar.
SidebarItem: badgeReactNode—A count or a Badge at the end.
SidebarItem: disabledbooleanfalseGreyed, out of the Tab order; aria-disabled.
SidebarItem: children · defaultOpenSidebarItem[] · boolean— · holds the currentOne level of items: a category, open when it holds the current page.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
sidebar<div>The column.
sidebar-nav<nav>The landmark, named by label.
sidebar-group<div>A group, between hairlines.
sidebar-group-label<div>Its label.
sidebar-item<li>An item: its link, or a category's button.
sidebar-item-badge<span>The count.

04

With your router

render takes the router's link; current comes from the route.

console-sidebar.tsx
const { pathname } = useLocation();

<SidebarItem label="Users" href="/users" render={<Link to="/users" />} current={pathname.startsWith("/users")} icon={UsersIcon} />
Next — SidebarAccessibility