Overview Button Copy button Field Input Number field Textarea Select Combobox Multiselect Date picker Date range picker Date-time picker Checkbox Radio group Position picker Switch Slider Dropzone Device controls Avatar Badge Card Collapsible Kbd Map Matrix Proportion bar Separator Stat Table Timeline Chat Playback Pagination Charts Chart theming Profile chart Time series chart Bar chart Isopleth chart TS diagram Box plot Rose chart Calendar chart Banner Toast Loader Progress Skeleton Empty state Error state Dropdown menu Tooltip Info tooltip Dialog Sheet Resizable Confirm dialog Breadcrumbs Command palette Mobile menu Navigation list Outline Scroll rail Sidebar Tabs
Sidebar
The app's main navigation, down the left edge of every page. One item per area; an area with many pages gets a navigation list inside its content instead.
Playground
Click items, drag the edge, or collapse it.
Missions
The page's content.
Width
<script lang="ts">
const sidebar = new SidebarState({ storageKey: 'app-sidebar' });
onMount(() => sidebar.restore());
</script>
<div class="flex h-dvh">
<Sidebar state={sidebar}>
{#snippet header()}<Logo class="size-6" />{/snippet}
<SidebarGroup label="Operations">
<SidebarItem href="/projects" icon="folder" label="Projects" active />
<SidebarItem href="/missions" icon="route" label="Missions" />
</SidebarGroup>
</Sidebar>
<main class="min-w-0 flex-1">...</main>
</div> Areas
An app in parts, each with its own pages: tabs at the top of the sidebar pick the part, and its navigation slides in from the side the tab is on. Only the picked tab shows its icon. Collapsed, the tabs become a column of icons.
Missions
The page's content.
Each area keeps its own page, so going back to one lands where you left it.
<script lang="ts">
const areas = [
{ value: 'operations', label: 'Operations', icon: 'ship' },
{ value: 'sales', label: 'Sales', icon: 'briefcase' },
{ value: 'delivery', label: 'Delivery', icon: 'file-export' },
];
let area = $state('operations');
</script>
<Sidebar state={sidebar}>
{#snippet header()}<Logo class="size-6" />{/snippet}
<SidebarTabs tabs={areas} bind:value={area} />
<SidebarAreas value={area} order={areas.map((a) => a.value)}>
{#snippet children(area)}
{#if area === 'operations'}
<SidebarGroup>
<SidebarItem href="/missions" icon="route" label="Missions" />
</SidebarGroup>
{:else if area === 'sales'}
...
{/if}
{/snippet}
</SidebarAreas>
</Sidebar> Behaviour
- Collapse
- The button at the bottom, or ⌘B / Ctrl+B anywhere outside a text field.
- Resize
- Drag the right edge, 200 to 360px. Drag past 140px and it collapses. Double-click the edge to reset to 240px.
- Keyboard
- Tab to the edge, then arrow keys resize (Shift for bigger steps) and Enter collapses.
- Remembered
- Pass a storageKey and the state and width survive reloads. Call restore() on mount.
- Fixed positions
- Icons, the logo and the toggle sit at the same spot open or collapsed. Only the width moves and labels fade.
- Active rail
- The current page gets the primary rail on the sidebar edge. It slides to the next page when you navigate.