Sidebar Nav

Collapsible workspace and chat navigation with gliding hover states.

Installation

pnpm dlx shadcn@latest add @ward/sidebar-nav

Add the Ward registry to components.json once:

"registries": {
  "@ward": "https://ward.so/r/{name}.json"
}

Or install from the URL with no configuration: npx shadcn@latest add https://ward.so/r/sidebar-nav.json

Usage

import SidebarNav from "@/components/ward/SidebarNav";
<SidebarNav
  fill
  activeNav="home"
  onNavigate={(key) => console.log(key)}
  recents={[
    { id: "suppliers", label: "Supplier records" },
    { id: "workload", label: "Workload summary", prompt: "Summarise this week's workload" },
  ]}
  onPick={(id, label) => console.log(id, label)}
  onNewChat={() => console.log("new chat")}
  footerLabel="Upgrade"
/>

Props

PropTypeDefaultDescription
variantstring"Default"Accepted for registry parity; the component has a single variant.
activeTitlestring | null-Label of the highlighted chat; when left undefined the sidebar tracks the selection itself.
classNamestring""Extra classes added to the sidebar element.
fillbooleanfalseMakes the sidebar take the full height of its parent instead of a fixed 600px.
onNewChat() => void-Called when the new chat button is pressed, and by the footer button when onFooterClick is not set.
onPick(id: string, label: string, prompt?: string) => void-Called with the chat's id, label and prompt when a recent chat is chosen.
activeNavstring-Key of the selected primary navigation item, such as "home" or "invite", for controlled use.
onNavigate(key: string) => void-Called with the item key when the primary navigation selection changes.
footerLabelstring"Upgrade"Text on the footer button.
footerIconReactNode-Icon shown before the footer button text.
onFooterClick() => void-Called when the footer button is pressed.
recentsSidebarRecent[]DEFAULT_RECENTSRecent chats listed under the navigation and filtered by the chat search field.

Ward · Version 1.1.0 · Registry manifest