Ansora sidebar
Side navigation with collapsing, a mobile drawer and a keyboard shortcut. A vendored and patched copy of the shadcn sidebar.
primitivenavigation
Install
pnpm dlx shadcn@4.23.0 add @ansora/sidebarExamples
Usage
For a whole application you usually do not want this primitive directly — install @ansora/app-shell, which composes the complete skeleton (AppShell) on top of it.
This item installs the sidebar and the useIsMobile hook, nothing else. In particular it does NOT install readSidebarState() — that helper ships with @ansora/app-shell (registry/ansora/lib/sidebar-state.ts), and it cannot also ship here: two items installing the same file would overwrite each other in your project.
If you compose your own layout, wrap the application in SidebarProvider and give it defaultOpen read on the server. Either install @ansora/app-shell for the helper, or read the cookie yourself:
import { cookies } from "next/headers"
export default async function Layout({ children }: { children: React.ReactNode }) {
const raw = (await cookies()).get("sidebar_state")?.value
const defaultOpen = raw === undefined ? true : raw === "true"
return <SidebarProvider defaultOpen={defaultOpen}>{children}</SidebarProvider>
}
Without it the sidebar re-expands on every navigation: the upstream sidebar writes that cookie but never reads it back.
Files
registry/ansora/ui/sidebar.tsx→@ui/ansora/sidebar.tsxregistry/ansora/hooks/use-mobile.ts→@hooks/ansora/use-mobile.ts
Dependencies
@ansora/basehttps://ui.shadcn.com/r/styles/base-nova/sheet.jsonhttps://ui.shadcn.com/r/styles/base-nova/tooltip.jsonhttps://ui.shadcn.com/r/styles/base-nova/skeleton.jsonhttps://ui.shadcn.com/r/styles/base-nova/separator.jsonhttps://ui.shadcn.com/r/styles/base-nova/input.jsonhttps://ui.shadcn.com/r/styles/base-nova/button.json
Ansora section card
A card for one section of a screen — heading with real heading semantics, optional description, a slot for a control, and an optionally scrollable body. The shell every data view on a dashboard sits in.
Ansora status pill
Status pill. Tones: neutral (in order), warn, critical, info. There is no green among them — green is the brand colour, never a state. Not a replacement for the upstream shadcn `badge`: that one is a generic label with variants, this one only ever says what state something is in.