# Empty state

- **[Atoms](/components/)**

What a list or page shows when there is nothing yet: an icon, one sentence and one next step.

## When to use

- **Use for**: A first-run list, an empty search, a cleared inbox.
- **Not for**: Errors. Use a Banner. Not for loading. Use Skeleton.
- **Pairs with**: Button, Card, lists and tables.

## Preview

empty-state.tsx

```
import { Inbox } from 'lucide-react';
import { Theme } from '@/components/klarhimmel/theme/style';
import { Button } from '@/components/klarhimmel/ui/button';
import { EmptyState } from '@/components/klarhimmel/ui/empty-state';

export default function Example() {
  return (
    <Theme theme="brand">
      <EmptyState icon={<Inbox />} title="No bookings yet" action={<Button>Add a booking</Button>}>
        Bookings appear here as soon as a guest reserves a room.
      </EmptyState>
    </Theme>
  );
}
```

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/empty-state @klarhimmel/button
  ```
- **Import**

  ```
  import { EmptyState } from '@/components/klarhimmel/ui/empty-state';
  ```

- **Files**: empty-state.tsx, button.tsx, in components/klarhimmel/ui/. With it: editing, theme, utils. npm: radix-ui.
- **Render in**: Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

## Examples

- **Search**

  ```
  import { SearchX } from 'lucide-react';
  import { Button } from '@/components/klarhimmel/ui/button';
  import { EmptyState } from '@/components/klarhimmel/ui/empty-state';
  
  export default function EmptyStateSearch() {
    return (
      <EmptyState
        level={2}
        icon={<SearchX />}
        title={'No rooms match "balcony sauna"'}
        description="Try fewer words, or clear the filters to see all 12 rooms."
        action={<Button variant="secondary">Clear filters</Button>}
      />
    );
  }
  ```
- **Compact**

  ```
  import { Card } from '@/components/klarhimmel/ui/card';
  import { EmptyState } from '@/components/klarhimmel/ui/empty-state';
  
  export default function EmptyStateCompact() {
    return (
      <Card className="w-full max-w-md p-2">
        <EmptyState level={4} title="No messages from guests" description="New messages show up here. You will also get an email." />
      </Card>
    );
  }
  ```

## Props

- **icon**: A lucide icon element.
- **title**: Required. The heading.
- **description**: One sentence: what this place is for and what to do. Same as children.
- **children**: One sentence under the title.
- **action**: The one next step, usually a Button.
- **level**: Heading level of the title, to fit the page outline.
- **className**: Extra classes, merged after the component's own.

## Accessibility

- Tab · Moves to the action button, if there is one
- Enter / Space · Activates the action

[Accessibility](/get-started/accessibility)

The title is a heading (level 3 by default; set level to fit the page outline). The icon is hidden from assistive tech.

[Previous](/components/dialog)

[Next](/components/answer-form)
