# Empty

A space pencilled in for what has not arrived yet: an icon, a title, a line of help and what to do about it.

Docs: https://ballpoint.st9wd.com/docs/empty

```bash
npx shadcn@latest add @ballpoint/empty
```

```tsx
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty"

<Empty>
  <EmptyHeader>
    <EmptyMedia variant="icon">…</EmptyMedia>
    <EmptyTitle>No sketches yet</EmptyTitle>
    <EmptyDescription>Start a page and it will turn up here.</EmptyDescription>
  </EmptyHeader>
  <EmptyContent>…</EmptyContent>
</Empty>
```

Props:

- `EmptyMedia variant`: `"default" | "icon"` (default `"default"`). A bare slot for anything, or an icon circled with the pen.
- `seed`: `string | number`. Pins the drawing.

Pen settings: `draw`, `roughness`, `passes`, `radius`, `corners`, `weight`, `speed` (see Pen settings).

## Example

```tsx
import { InkIcon } from "@/components/ui/ink-icons";
import { Button } from "@/components/ui/button";
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";

export default function EmptyDemo() {
  return (
    <Empty seed="empty-demo" className="w-full max-w-lg">
      <EmptyHeader>
        <EmptyMedia variant="icon" seed="empty-demo-icon">
          <InkIcon name="layers" />
        </EmptyMedia>
        <EmptyTitle>No sketches yet</EmptyTitle>
        <EmptyDescription>Start a page and it will turn up here, ready to carry on with.</EmptyDescription>
      </EmptyHeader>
      <EmptyContent>
        <div className="flex gap-3">
          <Button seed="empty-demo-new">New sketch</Button>
          <Button variant="outline" seed="empty-demo-import">
            Import
          </Button>
        </div>
      </EmptyContent>
    </Empty>
  );
}
```

## No results

A search that found nothing, with a way to try again.

```tsx
import { InkIcon } from "@/components/ui/ink-icons";
import { Button } from "@/components/ui/button";
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
import { Kbd } from "@/components/ui/kbd";

export default function EmptySearch() {
  return (
    <Empty seed="empty-search" className="w-full max-w-lg">
      <EmptyHeader>
        <EmptyMedia variant="icon" seed="empty-search-icon">
          <InkIcon name="search" />
        </EmptyMedia>
        <EmptyTitle>Nothing found</EmptyTitle>
        <EmptyDescription>No notes match &quot;margin doodles&quot;. Try a shorter word, or look in the archive.</EmptyDescription>
      </EmptyHeader>
      <EmptyContent>
        <InputGroup seed="empty-search-input">
          <InputGroupInput placeholder="Search notes…" aria-label="Search notes" />
          <InputGroupAddon align="inline-end">
            <Kbd>/</Kbd>
          </InputGroupAddon>
        </InputGroup>
        <Button variant="link" seed="empty-search-archive">
          Look in the archive
        </Button>
      </EmptyContent>
    </Empty>
  );
}
```

## With avatars

Use avatars instead of an icon to show who is missing.

```tsx
import { Avatar, AvatarFallback, AvatarGroup } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";
import { InkGlyph } from "@/lib/ink-glyphs";

export default function EmptyAvatars() {
  return (
    <Empty seed="empty-avatars" className="w-full max-w-lg">
      <EmptyHeader>
        <EmptyMedia>
          <AvatarGroup>
            {["AB", "KL", "MN"].map((initials) => (
              <Avatar key={initials} size="lg" seed={`empty-${initials}`}>
                <AvatarFallback>{initials}</AvatarFallback>
              </Avatar>
            ))}
          </AvatarGroup>
        </EmptyMedia>
        <EmptyTitle>Nobody else is here</EmptyTitle>
        <EmptyDescription>Invite people to the notebook to draw alongside you.</EmptyDescription>
      </EmptyHeader>
      <EmptyContent>
        <Button size="sm" seed="empty-avatars-invite">
          <InkGlyph name="plus" /> Invite people
        </Button>
      </EmptyContent>
    </Empty>
  );
}
```

## An error

The same layout in red pen, for something that failed.

```tsx
import { Button } from "@/components/ui/button";
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";
import { InkIcon } from "@/components/ui/ink-icons";

export default function EmptyError() {
  return (
    <Empty seed="empty-error" className="w-full max-w-lg">
      <EmptyHeader>
        <EmptyMedia variant="icon" seed="empty-error-icon" className="text-pen-red">
          <InkIcon name="alert-circle" />
        </EmptyMedia>
        <EmptyTitle>That page didn&apos;t load</EmptyTitle>
        <EmptyDescription>The connection dropped halfway down. Nothing was lost.</EmptyDescription>
      </EmptyHeader>
      <EmptyContent>
        <Button variant="outline" seed="empty-error-retry">
          <InkIcon name="refresh" /> Try again
        </Button>
      </EmptyContent>
    </Empty>
  );
}
```

## Pen settings

- `draw`: `"auto" | "mount" | "none"` (default `"auto"`). When the strokes draw themselves in: the first time they scroll into view, as soon as they render, or never (already drawn).
- `roughness`: `number` (default `1`). 0 is ruler-neat, 1 a quick confident hand, 2 a scrawl.
- `passes`: `1 | 2 | 3`. How many times an outline is gone over. Each component picks its own default.
- `radius`: `number | "full"` (default `0`). Corner radius in px; "full" draws a pill.
- `corners`: `"crossed" | "joined"` (default `"crossed"`). Square corners: sides pulled separately past each other, or the box drawn in one motion.
- `weight`: `number` (default `1`). Line weight multiplier. Also settable in CSS as --ink-weight.
- `speed`: `number` (default `1`). Drawing speed multiplier. Also settable in CSS as --ink-speed.
