# Drill-in sidebar

A shadcn/ui app sidebar where each level replaces the list, iOS-style, for deep settings and docs: every level sits on the same lines at any size.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available for the docs, pricing and about pages: append `.md` to the URL or send an `Accept: text/markdown` header (the home page answers the header too). An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).

## At a glance

- **Good for:** Settings pages with sections inside sections; Docs and help centres with deep navigation; Admin consoles with nested configuration; Mobile-first apps with a stacked sidebar
- **Category:** Navigation · **Type:** Sidebars · **Style:** Motion, Minimal, Dark mode
- **See it:** [Live preview](https://www.craftui.space/docs/blocks/drill-sidebar) · [Screenshot](https://www.craftui.space/llms.md/preview/drill-sidebar.27e6d4e4.jpg)

![Drill-in sidebar](https://www.craftui.space/llms.md/preview/drill-sidebar.27e6d4e4.jpg)

## Install

```bash
pnpm dlx shadcn@latest add https://www.craftui.space/r/drill-sidebar.json
```

This is a paid item (BLK-Q015JH): the install needs a craftUI plan or a purchase of it. Signed in, the docs page gives your personal install command. Plans: https://www.craftui.space/pricing

## Usage

```tsx
import DrillSidebar from "@/components/blocks/drill-sidebar/drill-sidebar";

export default function Page() {
  return <DrillSidebar />;
}
```

With no props it renders with demo content; pass your own through the props below.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `levels` | `Level[]` | `DEFAULT_LEVELS` | The levels; the one with id "root" is the top. Rows open others with `to`. |
| `workspaces` | `Workspace[]` | `DEFAULT_WORKSPACES` | Workspaces in the top level's switcher; the first is current. |
| `defaultActive` | `string` | `"inbox"` | Id of the link that starts active. |
| `onNavigate` | `(id: string) => void` | — | Called with the id of each link picked (not when a row drills in). |
| `onLevelChange` | `(levelId: string) => void` | — | Called with the id of each level opened, and the top's on the way back. |
| `onSwitchWorkspace` | `(id: string) => void` | — | Called when a workspace is picked in the switcher. |
| `onCreateWorkspace` | `() => void` | — | Called from the switcher's "Create workspace". |
| `children` | `React.ReactNode` | — | The page beside the sidebar. Defaults to placeholder content. |
| `className` | `string` | — | Height and placement, e.g. "h-svh" (the default) or "h-[40rem]". |
| `style` | `React.CSSProperties` | — | Sizes for this one sidebar, overriding the five numbers in sidebar-vars.ts, e.g. `{ "--sb-icon": "1.25rem", "--sb-row": "2.5rem" }`. Every level follows them. |

### `Level`

| Field | Type | Description |
| --- | --- | --- |
| `id` (required) | `string` | Unique id; rows point at it with `to`. |
| `title` (required) | `string` | Name in the header's back row and the page's breadcrumb, e.g. "Settings". |
| `groups` (required) | `DrillGroup[]` | The level's groups, in order. |

### `Workspace`

| Field | Type | Description |
| --- | --- | --- |
| `id` (required) | `string` | Unique id. |
| `name` (required) | `string` | Name, e.g. "Northwind". |
| `color` (required) | `string` | Background of the workspace's monogram, any CSS colour. |

### `DrillGroup`

| Field | Type | Description |
| --- | --- | --- |
| `id` (required) | `string` | Unique id within the level. |
| `label` | `string` | Small heading above the rows, e.g. "Workspace". Leave out for none. |
| `items` (required) | `DrillItem[]` | The rows, in order. |

### `DrillItem`

| Field | Type | Description |
| --- | --- | --- |
| `id` (required) | `string` | Unique id across all levels; matched against the active id. |
| `label` (required) | `string` | Text in the row, e.g. "Billing". |
| `icon` (required) | `IconSvgElement` | A Hugeicons icon from `@hugeicons/core-free-icons`. |
| `to` | `string` | Id of the level this row opens. A row with `to` drills in instead of navigating, and shows a chevron on the right spine. |
| `href` | `string` | Link target, for a row without `to`. Without it the row only changes the active item. |

## Files

The install adds:

- `components/blocks/drill-sidebar/drill-sidebar.tsx`
- `components/blocks/drill-sidebar/drill-level.tsx`
- `components/blocks/drill-sidebar/workspace-switcher.tsx`
- `components/blocks/drill-sidebar/nav-data.ts`
- `components/blocks/drill-sidebar/sidebar-vars.ts`
- `components/blocks/drill-sidebar/DESIGN.md`

npm dependencies (installed for you): `@hugeicons/core-free-icons`, `@hugeicons/react`, `motion`.

shadcn/ui components it uses (the shadcn CLI adds any that are missing): `dropdown-menu`, `sidebar`.