SideNav

Vertical nav. A hover pill stretches toward the item you point at; a marker stretches to the selected one. Navigation.

Open playground

About

SideNav is a React component in the Navigation category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { SideNav } from "@ashutoshswamy/smoui" and set items, defaultValue, onChange.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { SideNav } from "@ashutoshswamy/smoui";

<SideNav
  items={[{ id: "home", label: "Overview", icon: <Squares2X2Icon width={20} height={20} /> }, { id: "stats", label: "Analytics" }]}
  onChange={(id) => go(id)}
/>

Props 3

items

Entries.

{ id: string; label: string; icon?: ReactNode }[]
defaultValue

Initially selected id.

string
onChange

Called on select.

(id: string) => void