Components
Indicator Sidebar
A sidebar whose active marker slides to the current page.
<IndicatorSidebar items={items} current="#home" />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/indicator-sidebar.jsonimport { IndicatorSidebar } from "@/components/indicator-sidebar"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
A sidebar with a marker on its rail that slides to the current page. Pick another page in the demo to see it move.
import { IndicatorSidebar } from "@/components/indicator-sidebar";
export function OnThisPage({ active }: { active: string }) {
return <IndicatorSidebar label="On this page" items={[{ label: "Usage", href: "#usage" }, { label: "Props", href: "#props" }]} current={active} />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | { label, href }[] | The links. | |
current | string | The current page's href. | |
label | string | "Sections" | Accessible name of the nav. |
className | string | Classes for the root element. |
With reduced motion, the marker jumps instead of sliding.