# Side panel

A sheet for one record: badges, doors out to other tools, a copy-a-prompt handoff and a stats strip.

Section: Blocks / Work
Page: https://ui.heyramzi.com/components/side-panel
Import path: `@heyramzi/ui/panel`

## Import

```ts
import { SidePanel } from "@heyramzi/ui/panel";
import { Button } from "@heyramzi/ui/shadcn/button";
import type { OpenInTool } from "@heyramzi/ui/components/open-in";
```

## Usage

```svelte
<SidePanel
  bind:open
  title="Write the pricing page"
  description="Ada, due Friday"
  badges={[{ label: "In review", tone: "warning" }]}
>
  <p>The record's fields go here.</p>
</SidePanel>
```

## Demo

```svelte
<script lang="ts">
	import { SidePanel } from "@heyramzi/ui/panel";
	import { Button } from "@heyramzi/ui/shadcn/button";
	import type { OpenInTool } from "@heyramzi/ui/components/open-in";
	import { GithubLogo } from "phosphor-svelte";

	const github: OpenInTool = { name: "GitHub", action: "Open on GitHub", icon: GithubLogo };

	let open = $state(false);
</script>

<Button onclick={() => (open = true)}>Open the panel</Button>

<SidePanel
	bind:open
	title="Write the pricing page"
	description="Ada, due Friday"
	badges={[{ label: "In review", tone: "warning" }]}
	openIn={[
		{ tool: github, href: "https://github.com/heyramzi/ui", label: "Open the issue on GitHub" },
	]}
	handoff={{
		value: () => "Draft the pricing page copy for the three plans.",
		label: "Copy a prompt",
		copiedLabel: "Prompt copied",
	}}
	stats={[
		{ label: "Logged", value: "6h 30m", sub: "of 8h" },
		{ label: "Open comments", value: "0", tone: "good" },
	]}
>
	<p class="text-sm text-muted-foreground">
		The body scrolls under the header. Put the record's fields here.
	</p>
</SidePanel>
```

## API

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `open` | `boolean` |  | required. bindable |
| `title` | `string` |  | required. Names the dialog for screen readers and heads the panel. |
| `titleClass` | `string` |  | Merged onto the title. A short path is set `font-mono`, a subject is not. |
| `description` | `string` |  | The facts the record is filed under, read out under the title. |
| `badges` | `{ label: string; tone: Tone }[]` | `[]` | Status chips, left of the action row. |
| `openIn` | `{ tool: OpenInTool; href: string; label: string; text?: string }[]` | `[]` | Doors out to another tool. `text` replaces the tool's name on the button. |
| `handoff` | `{ value: () => string \| Promise<string>; label: string; copiedLabel: string }` |  | A prompt for an AI about this record, copied on click. |
| `stats` | `PanelStat[]` | `[]` | The record's numbers, as a strip under the badges. Same place in every panel. |
| `actions` | `Snippet` |  | Anything else the record can do, drawn last in the action row. |
| `footer` | `Snippet` |  | Pinned actions. The body scrolls above it; the caller aligns the row. |
| `children` | `Snippet` |  | required |
| `width` | `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | `"sm"` |  |
| `bare` | `boolean` | `false` | The body brings its own header: the title is read out but not drawn, and the body is neither padded nor scrolled by the panel. |
| `onOpenChange` | `(open: boolean) => void` |  | Called with the new state when the close button, Escape or the overlay closes the panel. |
