Skip to main content

AdminNav

Implemented

Horizontal admin navigation of pill links that marks the active item with aria-current, plus an aria-live empty state.

Categoryorganisms
Sourcecomponents/organisms/AdminNav/AdminNav.tsx
AI HintProvide AdminNavItem[] with activeId to mark the current page; items render as real <a href> links and onItemClick is a supplementary click hook, not a router. An empty items array renders the em-dash empty state.

Horizontal admin navigation of pill links marking the active item with aria-current="page", plus an aria-live empty state.

AdminNav

Organism — Admin family

A row of pill-shaped links where the active item (matched by activeId) carries aria-current='page' and a teal-tinted active style. Items are always real anchors — onItemClick is a supplementary hook, not a router. An empty items array renders a minimal em-dash nav (aria-live).

Click a pill — the active item carries aria-current="page" alongside the teal tint.

Active section: Aperçu

This component supports light and dark mode.

Usage

Match activeId to the item id (not the href — active state is never derived from the URL), keep labels short enough for one row, and name the nav by its purpose.

import { AdminNav } from '@epasslive/design-system'

const sections = [
  { id: 'overview', label: 'Aperçu', href: '/admin/overview' },
  { id: 'events', label: 'Événements', href: '/admin/events' },
  { id: 'payouts', label: 'Versements', href: '/admin/payouts' },
]

<AdminNav items={sections} activeId={active} ariaLabel="Sections d'administration" />

Conventions

Every item renders an <a href> — navigation works without JS, and onItemClick is a supplementary hook (analytics, close-a-drawer), not a router. items={[]} renders the designed em-dash placeholder while sections load. For more than ~6 items, use a sidebar or tab pattern instead.

Accessibility

The nav is a named <nav> landmark; the active item carries aria-current="page" (WCAG 2.4.8 / 1.3.1) so screen readers announce the current section without relying on the visual teal tint alone. The empty state renders in an aria-live="polite" span.

Props

Prop
Type
Default
Description
items*
AdminNavItem[]
—

Nav entries — one pill link per item (see the item table below).

activeId
string
—

Marks the item whose id matches as current (aria-current='page').

onItemClick
(id: string) => void
—

Click hook — fires for every item alongside the href navigation.

ariaLabel
string
"Admin navigation"

Accessible name for the nav landmark.

className
string
—

Class on the nav element.

id
string
—

Stable id for the nav.

Item definition

Prop
Type
Default
Description
id*
string
—

Item identifier — matches activeId, used as React key.

label*
string
—

Visible link text.

href*
string
—

Link target — items are always real anchors.

Props

Preview

AdminNav

Prop
Type
Required
Default
Description
items
AdminNavItem[]
Required
—

Nav entries (id, label, href) — one pill link per item; an empty array renders the em-dash empty state.

activeId
string
Optional
—

Marks the item whose id matches as current (aria-current="page" + teal active pill).

onItemClick
(id: string) => void
Optional
—

Click hook fired for every item click, in addition to the href navigation.

ariaLabel
string
Optional
'Admin navigation'

Accessible name for the <nav> landmark.

className
string
Optional
—

Extra classes appended to the <nav> shell (both populated and empty states).

id
string
Optional
—

Stable id forwarded to the <nav> element.

Quick use:<AdminNav />

Accessibility

ARIA rolenavigation

ARIA

3 rules

WCAG 1.3.1

renders a <nav> landmark named via aria-label (defaults to 'Admin navigation')

WCAG 2.4.8

active item link carries aria-current="page"; inactive links omit the attribute

WCAG 4.1.3

empty state (items=[]) announces the em-dash placeholder via a span with aria-live="polite"

Usage

Import

tsxSnippet
import { AdminNav } from "@epasslive/design-system"

Example 1

tsxSnippet
<AdminNav items={[{ id: 'overview', label: 'Overview', href: '/admin/overview' }]} activeId="overview" />
Design System v4.1.0 | ePassLive