Navigation

SideNavigationItem

Single list-wrapped navigation entry tuned for the vertical layout of side-navigation, delegating rendering to navigation-item.

import { SideNavigationItem } from '@lostgradient/cinder';
navigationsidebar
01

Overview

Individual link within a side navigation, supporting nesting and active highlighting.

Usage

SideNavigationItem is a compose-only leaf of SideNavigation. The idiomatic API is SideNavigation.Item, reached through the parent namespace — see the side-navigation README for the composed snippet. The leaf is also a named export of @lostgradient/cinder.

Rows, counts and the collapsed rail

A row is one 30px control (44px under a coarse pointer): hover, focus and the active fill paint the whole row. Default text is secondary with no fill; hover gives a lighter neutral tint and primary text; the active row is a flat soft accent-tinted fill with no shadow, default text, semibold weight and aria-current="page" and takes no hover change, because accent text is for actions and links; keyboard focus draws the quiet ring around the whole row.

svelte
<SideNavigation.Item href="/reviews" label="Reviews" count={2} countLabel="need you">
  {#snippet icon()}<Inbox aria-hidden="true" size={16} />{/snippet}
  Reviews
</SideNavigation.Item>
<SideNavigation.Item
  href="/health"
  label="Health"
  count={3}
  countLabel="need attention"
  dot="warning"
>
  {#snippet icon()}<Activity aria-hidden="true" size={16} />{/snippet}
  Health
</SideNavigation.Item>
  • Count: a count is plain, muted, 13px text at the trailing edge of the row, never a badge. On the icon rail it becomes a small dot on the icon's corner.
  • Badge: badge="Plugin" marks the kind of entry with a neutral extra-small Badge at the trailing edge, where the count sits. It is mutually exclusive with count and dot: a row with a badge reports neither. The label ends in an ellipsis on one line before the badge, which is never cut, and the row keeps its height. The badge joins the accessible name and tooltip in lower case ("Reports, plugin"), and a collapsed row draws no badge, since its tooltip says the same.
  • Accessible name: with label and a non-zero count, the link is named "Health, 3 need attention" or "Reviews, 2 need you". The count and the dot are hidden from assistive technology, so colour is never the only signal.
  • Tooltip: a row with a count shows its name as a tooltip on hover and focus ("Health, 3 need attention"). A collapsed row shows "Reviews, 2 need you", or the label alone when there is no count.
  • Collapsed rail: inside a Sidebar a row follows the sidebar's collapsed state on its own (pass collapsed to override). A row with an icon becomes a 40px target: the label is clipped but stays in the accessible name, and the count or dot moves onto the icon's corner. A row without icon is unchanged.
  • Do not also set title: the browser would show its own tooltip beside this one.
02

When to use

Use when
  • Rendering one entry inside a side-navigation column or side-navigation-group.
  • Keeping list semantics correct so screen readers announce sidebar entry counts.
Avoid when
  • Placing entries in a horizontal navigation-bar — use navigation-item directly.
  • Rendering outside a side-navigation list — use navigation-item without the list wrapper.