# Page preview card

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

A page shown as a picture: the real page scaled into a 16:10 card, with its title, a meta line and a badge. The whole card is one link.

## Preview

page-preview-card.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { PagePreviewCard } from '@/components/klarhimmel/ui/page-preview-card';

export default function Example() {
  return (
    <Theme theme="brand">
      <PagePreviewCard src="/preview/bakery" href="/pages/bakery" title="Bakery" meta="bakery.klarhimmel.page" badge="Live" />
    </Theme>
  );
}
```

## Import

- **CLI**

  ```
  npx shadcn add https://ui.klarhimmel.com/r/page-preview-card.json
  ```
- **Import**

  ```
  import { PagePreviewCard } from '@/components/klarhimmel/ui/page-preview-card';
  ```

- **Files**: page-preview-card.tsx, in components/klarhimmel/ui/. With it: badge, skeleton, theme, utils.
- **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.

## Props

- **src**: The page to show: a same-origin preview URL. It renders at `viewport` px wide and is scaled down to the card.
- **title**: One line; the card's link text.
- **href**: Where the card goes (the editor, the live page).
- **meta**: A quiet line under the title: the address, when it was changed.
- **badge**: A string becomes a neutral Badge (Live, Draft); pass a Badge for another tone.
- **viewport**: The width the page is laid out at before scaling. 1280 shows the desktop layout; 390 a phone.
- **sandbox**: Iframe sandbox. The default runs no scripts, so a preview must be server-rendered HTML.
- **link**: Renders the title link, for a router's Link (keeps app paths and client navigation). Default: a plain <a>.
- **className**: Extra classes, merged after the component's own.

[Previous](/components/grid-card)

[Next](/components/tab-bar)
