Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

SidebarItem

  • Stable
  • WCAG 2.2 evidence
  • RTL

One entry of a Sidebar. With href it is a React Aria Link (aria-current="page" when isCurrent); without href it is a Button; with SidebarSubItem children it is a disclosure button (aria-expanded) that shows them below. The Figma Variant and Collapsed properties come from the enclosing Sidebar. Accessibility: Tab moves between items, Enter activates links (Enter and Space buttons), keyboard focus shows the Figma 2 px focus ring (WCAG 2.1.1, 2.4.7). The current item is announced (aria-current) and shown by more than colour: bold label, indicator bar (kept in the collapsed rail) and fill (1.4.1). In the collapsed rail the label stays the accessible name (visually hidden) and a tooltip shows it on hover and focus (1.4.13). Rows are at least 40 px tall (2.5.8). Consumer duties: labels that match page titles; isCurrent on exactly one destination.

import { SidebarItem } from "@nexera-ui/react";
Loading example…
6
examples
30
props
6
live controls
1
platform
12
WCAG criteria
1
block uses it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
label
isCurrent
children
isExpanded
defaultExpanded
isDisabled
Generated code
import { SidebarItem } from "@nexera-ui/react";

<SidebarItem />

Examples 5

The same examples as Storybook, rendered live. Open Code to copy one.

States brand

Figma State: Selected (isCurrent), Default, with badge, Disabled, a button item and a group with sub-items.

Loading example…

States light

Figma Variant=Light.

Loading example…

Collapsed

Figma Collapsed=True: icon only; focus or hover an item for its tooltip. The badge becomes a dot.

Loading example…

Long label

Long labels wrap instead of truncating.

Loading example…

Right to left

Right to left: the indicator and badge move to the other side.

Loading example…

Props 30

Press "Try it" on a card to load that prop into the playground.

30 props shown

icon*Nexera
ReactNode

Icon, 20 px. Required: it is all the collapsed rail shows. Decorative: the label names the item.

Default –
label*Nexera
ReactNode

Visible label and accessible name. One or two words matching the page title. It wraps when expanded; in the collapsed rail it is visually hidden and shown in a tooltip.

Default –
badgeNexera
ReactNode

Count or short status, shown when provided: a pill when expanded, an 8 px dot in the collapsed rail. Its text is part of the accessible name ("Approvals 3").

Default –
badgeLabelNexera
string

Text announced instead of badge, for example "3 pending" (the visible badge is then hidden from assistive technology). Translate it for your locale.

Default –
isCurrentNexera
boolean

The item is the current page or section. Links get aria-current="page"; buttons and group triggers get aria-current="true". Shown by fill, bold label (expanded) and the indicator bar.

Default false
classNameNexera
string

Extra classes for the row, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style for the row.

Default –
childrenNexera
ReactNode

Only for group items. SidebarSubItem elements. Makes the row a disclosure button with the Figma chevron; the sub-items show while it is expanded and are hidden in the collapsed rail (pressing the row there expands the sidebar and the group).

Default –
isExpandedNexera
boolean

Only for group items. Whether the sub-items are shown (controlled). Use with onExpandedChange.

Default –
defaultExpandedNexera
boolean

Only for group items. Whether the sub-items are shown on first render (uncontrolled). Expand the group that holds the current page.

Default false
onExpandedChangeNexera
(isExpanded: boolean) => void

Only for group items. Called when the group expands or collapses.

Default –
idReact Aria
string

The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

Default –
isDisabledReact Aria
boolean

Whether the link is disabled.

Default false
autoFocusReact Aria
boolean

Whether the element should receive focus on render.

Default –
onPressReact Aria
(e: PressEvent) => void

Handler that is called when the press is released over the target.

Default –
onPressStartReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction starts.

Default –
onPressEndReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.

Default –
onPressChangeReact Aria
(isPressed: boolean) => void

Handler that is called when the press state changes.

Default –
onPressUpReact Aria
(e: PressEvent) => void

Handler that is called when a press is released over the target, regardless of whether it started on the target or not.

Default –
aria-labelReact Aria
string

Defines a string value that labels the current element.

Default –
aria-labelledbyReact Aria
string

Identifies the element (or elements) that labels the current element.

Default –
aria-describedbyReact Aria
string

Identifies the element (or elements) that describes the object.

Default –
hrefReact Aria
string

A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href). A group row is a button; link its first page from a sub-item.

Default –
hrefLangReact Aria
string

Hints at the human language of the linked URL. See[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang).

Default –
targetReact Aria
HTMLAttributeAnchorTarget

The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target).

Default –
relReact Aria
string

The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).

Default –
downloadReact Aria
string | boolean

Causes the browser to download the linked URL. A string may be provided to suggest a file name. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download).

Default –
pingReact Aria
string

A space-separated list of URLs to ping when the link is followed. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#ping).

Default –
referrerPolicyReact Aria
"" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"

How much of the referrer to send when following the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#referrerpolicy).

Default –
routerOptionsReact Aria
never

Options for the configured client side router.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

8 direct · 4 supporting
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.2Meaningful SequenceLevel A · supporting test
  • 1.4.1Use of ColorLevel A · supporting test
  • 1.4.4Resize TextLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 1.4.13Content on Hover or FocusLevel AA · tested directly
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.3Focus OrderLevel A · tested directly
  • 2.4.4Link Purpose (In Context)Level A · tested directly
  • 2.4.7Focus VisibleLevel AA · tested directly
  • 2.5.3Label in NameLevel A · tested directly
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-current
  • data-disabled
  • data-hovered
  • data-pressed
Usage
<SidebarItem className="data-current:opacity-90 shadow-sm" />

Used in blocks

Related components