The dashboard frame: a collapsible sidebar, a top bar and scrolling content. Below 1024px the sidebar becomes a drawer.
import { AppShell, Sidebar, SidebarHeader, SidebarContent, SidebarGroup, SidebarItem, SidebarFooter, Topbar, SidebarTrigger } from "kivu-ui"On this page
import { AppShell, Sidebar, SidebarHeader, SidebarContent, SidebarGroup, SidebarItem, SidebarFooter, Topbar, SidebarTrigger } from "kivu-ui";Revenue
$48,120
Churn
2.1%
import {
AppShell, Avatar, Badge, IconTile, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarHeader,
SidebarItem, SidebarTrigger, StatCard, Topbar,
} from "kivu-ui";
const icon = (d: string) => (
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d={d} /></svg>
);
const HomeIcon = icon("M2.5 7 8 2.5 13.5 7v6.5h-11z");
const ChartIcon = icon("M2.5 13.5h11M4.5 11V7M8 11V4M11.5 11V8.5");
const InboxIcon = icon("M2.5 9.5h3l1 2h3l1-2h3M2.5 9.5 4.5 3.5h7l2 6v3.5h-11z");
const UsersIcon = icon("M6 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM1.5 13.5c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4M11 3a2.2 2.2 0 0 1 0 4.4M12.5 9.7c1.3.5 2 1.8 2 3.8");
export default function Demo() {
return (
<div className="w-full overflow-hidden rounded-kivu-xl border border-line">
<AppShell
className="h-[460px] min-h-0"
sidebar={
<Sidebar>
<SidebarHeader>
<IconTile size="sm" variant="solid">{ChartIcon}</IconTile>
<span className="font-display font-semibold">Nyota</span>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarItem href="#app-shell" icon={HomeIcon} active>Overview</SidebarItem>
<SidebarItem href="#app-shell" icon={ChartIcon}>Reports</SidebarItem>
<SidebarItem href="#app-shell" icon={InboxIcon} badge={<Badge size="sm">12</Badge>}>Inbox</SidebarItem>
</SidebarGroup>
<SidebarGroup label="Workspace">
<SidebarItem href="#app-shell" icon={UsersIcon}>Team</SidebarItem>
</SidebarGroup>
</SidebarContent>
<SidebarFooter>
<Avatar name="Amara Uwase" size="sm" />
<span className="text-sm">Amara Uwase</span>
</SidebarFooter>
</Sidebar>
}
header={
<Topbar>
<SidebarTrigger />
<span className="font-semibold">Overview</span>
</Topbar>
}
>
<div className="grid gap-4 sm:grid-cols-2">
<StatCard label="Revenue" value="$48,120" delta={12.5} deltaLabel="vs last month" />
<StatCard label="Churn" value="2.1%" delta={-0.4} invertTrend deltaLabel="vs last month" />
</div>
</AppShell>
</div>
);
}Extends <div> attributes.
| Prop | Type | Default | Description |
|---|---|---|---|
sidebar | ReactNode | - | Usually a <Sidebar>. |
header | ReactNode | - | Usually a <Topbar>. Sticks to the top of the main column. |
sidebarCollapsed | boolean | - | Collapsed state (controlled). |
defaultSidebarCollapsed | boolean | false | Initial collapsed state. |
onSidebarCollapsedChange | (collapsed: boolean) => void | - | Called when the sidebar collapses or expands. |
padding | "none" | "sm" | "md" | "lg" | "md" | Padding around the page content. |
mainClassName | string | - | Class for the <main> element. |
Extends <a> attributes.
| Prop | Type | Default | Description |
|---|---|---|---|
icon | ReactNode | - | Icon on the left; the only thing shown when collapsed. |
badge | ReactNode | - | Count or status on the right. |
active | boolean | false | Marks the current page (aria-current). |
asChild | boolean | false | Render the single child (e.g. a router Link) with this item's styles and behaviour. |
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | - | Small heading above the group. Hidden when collapsed. |
| Prop | Type | Default | Description |
|---|---|---|---|
returns | { collapsed, setCollapsed, mobileOpen, setMobileOpen, toggleSidebar } | - | Shell state, for building your own trigger. |
Every component also accepts className and forwards its ref. Root CSS class: .kivu-shell