# Post Card

- Page: <https://kznlabs.github.io/labsUI/components/post-card>

## Post Card (`post-card`, block)

Tile for a blog post or portfolio project: cover, date, title, excerpt and tags. The whole card is one link with its focus ring on the card, your own action links stay clickable on top. Server-safe.

- Install: `npx @kznlabs/labsui add post-card`
- Docs: <https://kznlabs.github.io/labsUI/components/post-card>
- Brings: aspect-ratio, badge, link, utils
- npm: clsx@^2.1.1, tailwind-merge@^3.7.0

### API

- `<PostCard>` (+ <article> props): Tile for a blog post or portfolio project: cover, date, title, excerpt and tags, with the whole card as one link.
  - `title: ReactNode`: Title of the post or project, the card's heading.
  - `action?: ReactNode`: Your own links, e.g. to a project's source. They stay clickable over the card's link.
  - `as?: "h2" | "h3" | "h4"` = `"h3"`: Heading level, to fit the page's outline.
  - `dateTime?: string`: Machine-readable date for `time`, e.g. "2026-10-21".
  - `excerpt?: ReactNode`: One or two sentences, cut off after three lines.
  - `href?: string`: Page it leads to. The whole card becomes the link.
  - `media?: ReactNode`: Cover (`<img>`). Left out, the card is text only.
  - `meta?: ReactNode`: Beside the date, e.g. the author or "6 min read".
  - `onNavigate?: (href: string, event: MouseEvent<HTMLAnchorElement, MouseEvent>) => void`: `onClick` for the card's link, e.g. for client routing or to stub the link in a demo.
  - `ratio?: number` = `16 / 9`: Cover width/height, e.g. 1 for square.
  - `tags?: string[]`: Topics or a project's stack, as badges.
  - `time?: ReactNode`: Date as shown, e.g. "Oct 21, 2026" or a year.

### Usage

```tsx
<PostCard title="Keeping clips after a match" href="/blog/clips" time="Oct 21, 2026" dateTime="2026-10-21" meta="6 min read" excerpt="Where clips go and how long they stay." tags={["Guides"]} media={<img src="/cover.jpg" alt="" />} />
```

### Example: blog-list.tsx

```tsx
import { PostCard } from "@/components/blocks/post-card";

export function BlogList() {
  return (
    <div className="grid gap-4 sm:grid-cols-2">
      <PostCard
        as="h2"
        title="Keeping clips after a match"
        href="/blog/keeping-clips"
        time="Oct 21, 2026"
        dateTime="2026-10-21"
        meta="6 min read"
        excerpt="Where clips go once a match ends and how long they stay."
        tags={["Guides"]}
        media={<img src="/covers/clips.jpg" alt="" />}
      />
      <PostCard
        as="h2"
        title="Why we moved to one spring"
        href="/blog/one-spring"
        time="Sep 3, 2026"
        dateTime="2026-09-03"
        excerpt="A text-only post needs no cover."
      />
    </div>
  );
}
```

### Example: project.tsx

```tsx
import { PostCard } from "@/components/blocks/post-card";

export function Project() {
  return (
    <PostCard
      title="Harbor booking"
      href="/work/harbor"
      time="2026"
      meta="Client work"
      excerpt="A booking flow for a small marina."
      tags={["Next.js", "Postgres"]}
      action={<a className="text-sm underline" href="https://example.com/harbor">Source</a>}
    />
  );
}
```
