Skip to content
Klarhimmel UI

Page preview card

Bakery

bakery.klarhimmel.page

Live
npx shadcn add https://ui.klarhimmel.com/r/page-preview-card.json
DetailsAbout, usage, props and more

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

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

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