Skip to main content
Version: latest
Works everywhere

Sidenav works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/sidenav) — the library detects the runtime automatically.

Sidenav

Sidenav renders a vertical navigation panel. Supports nested sections, icon labels, collapsible groups, and automatic active-item highlighting based on the current URL.

Live demo →

Overview

import { Sidenav } from "@prokodo/ui/sidenav"
;<Sidenav
items={[
{ label: "Home", href: "/", icon: "home" },
{
label: "Products",
icon: "box",
children: [
{ label: "All products", href: "/products" },
{ label: "Categories", href: "/products/categories" },
],
},
]}
/>

Import

import { Sidenav } from "@prokodo/ui/sidenav"

CSS:

import "@prokodo/ui/sidenav.css"

Props

PropTypeDefaultRequiredDescription
itemsSidenavItem[]Navigation item tree.
initialCollapsedbooleanfalseStart in collapsed state.
collapsedIconstringIcon name shown when collapsed.
unCollapsedIconstringIcon name shown when expanded.
collapsedLabelstringAccessible label for the collapsed state toggle.
unCollapsedLabelstringAccessible label for the expanded state toggle.
iconPropsIconPropsProps applied to nav item icons.
ariaLabelstringAccessible label for the nav landmark.
renderFooter() => ReactNodeCustom footer render function.
onChange(item: SidenavItem) => voidCalled when a nav item is clicked.
classNamestringCSS class on root element.

SideNavSection

PropTypeDefaultRequiredDescription
itemsSideNavItem[]Navigation items belonging to this section.
headlinestringPlain-text section heading rendered via the internal Headline component (hidden in collapsed mode).
descriptionstringShort description below the headline.
headlineComponentComponentType<{ className?: string }>Custom React component used instead of headline string.
headlinePropsOmit<HeadlineProps, "children">Props forwarded to the section's Headline (overrides global headlineProps).
descriptionPropsOmit<HTMLAttributes<p>, "children">Props forwarded to the section's description <p> (overrides global descriptionProps).

See src/components/sidenav/Sidenav.model.ts for the full SidenavProps type.


AIC Note

Use the standard import path in application code:

import { Sidenav } from "@prokodo/ui/sidenav"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
2.1.1Keyboard (A)🔍 Manual reviewAll functionality must be operable via keyboard alone, without requiring specific timing.
2.4.3Focus Order (A)🔍 Manual reviewThe keyboard focus sequence must preserve meaning and operability in the complete page integration context.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
2.4.11Focus Not Obscured (Min.) (AA)🔍 Manual reviewThe focused component must not be fully hidden by sticky headers, overlays, or other positioned page elements.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.

Test coverage: 2 jest-axe assertion(s) across 4 test file(s) · 3 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.


Design Tokens

Customise Sidenav via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-sidenav-bgvar(--pk-color-surface)Background color of the sidebar panel
--pk-sidenav-shadowvar(--pk-shadow-md)Box-shadow of the sidebar panel
--pk-sidenav-toggle-hovervar(--pk-color-surface-raised)Background color of the toggle button on hover
--pk-sidenav-link-hover-bgcolor-mix(in srgb, var(--pk-color-brand) 10%, transparent)Background color of nav items on hover/active
--pk-sidenav-link-active-bgcolor-mix(in srgb, var(--pk-color-brand) 5%, transparent)Background color of the current page nav item
--pk-sidenav-icon-colorvar(--pk-color-fg)Icon foreground color
--pk-sidenav-icon-bgvar(--pk-color-surface-raised)Icon wrapper background color
--pk-sidenav-label-colorcolor-mix(in srgb, var(--pk-color-fg) 70%, transparent)Collapse icon and label color
--pk-sidenav-fgvar(--pk-color-fg)Main nav item label color
--pk-sidenav-radiusvar(--pk-radius-sm)Border-radius for nav items and icon wrappers
--pk-sidenav-gapvar(--pk-space-xs)Gap between nav list items
--pk-sidenav-link-gapvar(--pk-space-md)Internal gap inside each nav item
--pk-sidenav-section-headline-colorcolor-mix(in srgb, var(--pk-color-fg) 45%, transparent)Color of section headline labels

Storybook

👉 Open Sidenav in Storybook


Source

src/components/sidenav/Sidenav.model.ts