Skip to content
ui8kit

block / general

Post Card

Post Card block

Install

npx ui8kit add post-card

Pulls in: block, box, card-content, compose, group, kit-box, kit-link, kit-text, link, lucide-icon, media-frame, presets, text, title, utils

Preview

Design tokens without the drift

How one list of tokens feeds every runtime and every theme.

By

Mar 11, 2026

5 min read

Code

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdn
npx ui8kit add post-card
blocks/post-card.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A post as a card: cover picture, category, title, excerpt, author line and a read link. Axes: layout
  (vertical, horizontal), media (image, none), meta (full, short: the date only, news: date and title only),
  density.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Post, PostLabels } from "./post-card.types";

  export type PostCardProps = {
    post: Post;
    labels: PostLabels;
    layout?: "vertical" | "horizontal";
    media?: "image" | "none";
    meta?: "full" | "short" | "news";
    density?: "default" | "compact";
  };
</script>

<script lang="ts">
  import Block from "../compose/Block.svelte";
  import Box from "../compose/Box.svelte";
  import CardContent from "../compose/CardContent.svelte";
  import Group from "../compose/Group.svelte";
  import Link from "../compose/Link.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Text from "../compose/Text.svelte";
  import Title from "../compose/Title.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import { defaults } from "../presets/defaults";
  import { cn, tpl, urlOf } from "../utils";

  let {
    post,
    labels,
    layout = "vertical",
    media = "image",
    meta = "full",
    density = "default",
  }: PostCardProps = $props();
</script>

{#if ((meta as string) === "news")}
  <Block
    tag="article"
    class={cn(
      "flex flex-col gap-2 overflow-hidden rounded p-0 inset-ring inset-ring-border",
      defaults.news.card
    )}
    data-layout={layout}
    data-meta="news"
    data-slot="item"
  >
    <Box class={cn("relative shrink-0 overflow-hidden", defaults.news.cover)} data-slot="news-cover">
      <MediaFrame alt={post.title} src={post.image} class={cn("size-full", defaults.media.rounded)} />
      <Title
        as={3}
        size="xs"
        weight="semibold"
        class={cn(
          "pointer-events-none absolute inset-x-12 line-clamp-2 text-center leading-5 text-foreground",
          defaults.news.title
        )}
        data-slot="news-title"
      >
        {post.title}
      </Title>
    </Box>
    <Group
      gap="2"
      align="center"
      class={cn("w-full px-2 text-muted-foreground", defaults.news.strip)}
      data-slot="news-date"
    >
      <LucideIcon name="calendar" size={16} />
      <Text size="xs" weight="bold" class="leading-4">
        {post.date}
      </Text>
      {#if post.category}
        <Text size="xs" weight="bold" class="leading-4">
          {post.category}
        </Text>
      {/if}
    </Group>
  </Block>
{:else}
  <Block
    tag="article"
    class={cn(
      "flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded",
      "h-full gap-4 overflow-hidden",
      (((layout as string) === "horizontal") ? "flex flex-col sm:flex-row" : "flex flex-col")
    )}
    data-slot="card"
    data-layout={layout}
    data-meta={meta}
  >
    {#if ((media as string) === "image")}
      <Box class={cn("relative shrink-0", (((layout as string) === "horizontal") ? "sm:w-64" : ""))}>
        <MediaFrame alt={post.title} src={post.image} class="h-full" />
      </Box>
    {/if}
    <CardContent class="flex flex-1 flex-col gap-2">
      {#if ((meta as string) !== "news")}
        <Group gap="2" align="center">
          <LucideIcon name={post.icon} size={16} />
          <Text size="xs" class="uppercase tracking-wide text-muted-foreground">
            {post.category}
          </Text>
        </Group>
      {/if}
      <Title as={3} size="xl" weight="bold">
        {post.title}
      </Title>
      {#if (((density as string) === "default") && ((meta as string) !== "news"))}
        <Text size="sm" class="text-muted-foreground">
          {post.excerpt}
        </Text>
      {/if}
      {#if ((meta as string) !== "news")}
        <Group gap="2" class="mt-auto flex-wrap pt-2 text-muted-foreground">
          {#if ((meta as string) === "full")}
            <Text size="xs">
              {tpl(labels.by, post.author)}
            </Text>
          {/if}
          <Text size="xs">
            {post.date}
          </Text>
          {#if ((meta as string) === "full")}
            <Text size="xs">
              {tpl(labels.minutes, post.minutes)}
            </Text>
          {/if}
        </Group>
      {/if}
      {#if (((meta as string) !== "news") && post.href)}
        <Link href={urlOf(post.href)} variant="default" data-slot="read">
          {labels.read}
        </Link>
      {/if}
    </CardContent>
  </Block>
{/if}
blocks/post-card.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Post = {
  id: string;
  title: string;
  excerpt: string;
  category: string;
  author: string;
  date: string;
  minutes: number;
  icon: string;
  href?: string;
  image?: string;
};

export type PostLabels = {
  minutes: string;
  by: string;
  read: string;
  empty: string;
};

Svelte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdn
npx ui8kit add post-card
blocks/post-card.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A post as a card: cover picture, category, title, excerpt, author line and a read link. Axes: layout
 * (vertical, horizontal), media (image, none), meta (full, short: the date only, news: date and title only),
 * density.
 */
import { type ReactNode } from "react";
import { Block, Box, CardContent, Group, Link, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { defaults } from "../presets/defaults";
import { cn, tpl, urlOf } from "../utils";
import type { Post, PostLabels } from "./post-card.types";

export type PostCardProps = {
  post: Post;
  labels: PostLabels;
  layout?: "vertical" | "horizontal";
  media?: "image" | "none";
  meta?: "full" | "short" | "news";
  density?: "default" | "compact";
};

export function PostCard({
  post,
  labels,
  layout = "vertical",
  media = "image",
  meta = "full",
  density = "default",
}: PostCardProps) {
  return (
    <>
      {((meta as string) === "news") ? (
        <Block
          tag="article"
          className={cn(
            "flex flex-col gap-2 overflow-hidden rounded p-0 inset-ring inset-ring-border",
            defaults.news.card
          )}
          data-layout={layout}
          data-meta="news"
          data-slot="item"
        >
          <Box className={cn("relative shrink-0 overflow-hidden", defaults.news.cover)} data-slot="news-cover">
            <MediaFrame alt={post.title} src={post.image} className={cn("size-full", defaults.media.rounded)} />
            <Title
              as={3}
              size="xs"
              weight="semibold"
              className={cn(
                "pointer-events-none absolute inset-x-12 line-clamp-2 text-center leading-5 text-foreground",
                defaults.news.title
              )}
              data-slot="news-title"
            >
              {post.title}
            </Title>
          </Box>
          <Group
            gap="2"
            align="center"
            className={cn("w-full px-2 text-muted-foreground", defaults.news.strip)}
            data-slot="news-date"
          >
            <LucideIcon name="calendar" size={16} />
            <Text size="xs" weight="bold" className="leading-4">
              {post.date}
            </Text>
            {post.category ? (
              <Text size="xs" weight="bold" className="leading-4">
                {post.category}
              </Text>
            ) : null}
          </Group>
        </Block>
      ) : (
        <Block
          tag="article"
          className={cn(
            "flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded",
            "h-full gap-4 overflow-hidden",
            (((layout as string) === "horizontal") ? "flex flex-col sm:flex-row" : "flex flex-col")
          )}
          data-slot="card"
          data-layout={layout}
          data-meta={meta}
        >
          {((media as string) === "image") ? (
            <Box className={cn("relative shrink-0", (((layout as string) === "horizontal") ? "sm:w-64" : ""))}>
              <MediaFrame alt={post.title} src={post.image} className="h-full" />
            </Box>
          ) : null}
          <CardContent className="flex flex-1 flex-col gap-2">
            {((meta as string) !== "news") ? (
              <Group gap="2" align="center">
                <LucideIcon name={post.icon} size={16} />
                <Text size="xs" className="uppercase tracking-wide text-muted-foreground">
                  {post.category}
                </Text>
              </Group>
            ) : null}
            <Title as={3} size="xl" weight="bold">
              {post.title}
            </Title>
            {(((density as string) === "default") && ((meta as string) !== "news")) ? (
              <Text size="sm" className="text-muted-foreground">
                {post.excerpt}
              </Text>
            ) : null}
            {((meta as string) !== "news") ? (
              <Group gap="2" className="mt-auto flex-wrap pt-2 text-muted-foreground">
                {((meta as string) === "full") ? (
                  <Text size="xs">
                    {tpl(labels.by, post.author)}
                  </Text>
                ) : null}
                <Text size="xs">
                  {post.date}
                </Text>
                {((meta as string) === "full") ? (
                  <Text size="xs">
                    {tpl(labels.minutes, post.minutes)}
                  </Text>
                ) : null}
              </Group>
            ) : null}
            {(((meta as string) !== "news") && post.href) ? (
              <Link href={urlOf(post.href)} variant="default" data-slot="read">
                {labels.read}
              </Link>
            ) : null}
          </CardContent>
        </Block>
      )}
    </>
  );
}
blocks/post-card.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Post = {
  id: string;
  title: string;
  excerpt: string;
  category: string;
  author: string;
  date: string;
  minutes: number;
  icon: string;
  href?: string;
  image?: string;
};

export type PostLabels = {
  minutes: string;
  by: string;
  read: string;
  empty: string;
};

React registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdn
npx ui8kit add post-card
blocks/post-card.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Post = {
  id: string;
  title: string;
  excerpt: string;
  category: string;
  author: string;
  date: string;
  minutes: number;
  icon: string;
  href?: string;
  image?: string;
};

export type PostLabels = {
  minutes: string;
  by: string;
  read: string;
  empty: string;
};
blocks/post-card.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A post as a card: cover picture, category, title, excerpt, author line and a read link. Axes: layout
  (vertical, horizontal), media (image, none), meta (full, short: the date only, news: date and title only),
  density.
-->
<script lang="ts">
import type { Post, PostLabels } from "./post-card.types";

export type PostCardProps = {
  post: Post;
  labels: PostLabels;
  layout?: "vertical" | "horizontal";
  media?: "image" | "none";
  meta?: "full" | "short" | "news";
  density?: "default" | "compact";
};
</script>

<script setup lang="ts">
import Block from "../compose/Block.vue";
import Box from "../compose/Box.vue";
import CardContent from "../compose/CardContent.vue";
import Group from "../compose/Group.vue";
import Link from "../compose/Link.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import MediaFrame from "../components/media-frame.vue";
import { defaults } from "../presets/defaults";
import { cn, tpl, urlOf } from "../utils";

const {
  post,
  labels,
  layout = "vertical",
  media = "image",
  meta = "full",
  density = "default",
} = defineProps<PostCardProps>();
</script>

<template>
  <Block v-if="((meta as string) === 'news')"
    tag="article"
    :class="cn(
      'flex flex-col gap-2 overflow-hidden rounded p-0 inset-ring inset-ring-border',
      defaults.news.card
    )"
    :data-layout="layout"
    data-meta="news"
    data-slot="item"
  >
    <Box :class="cn('relative shrink-0 overflow-hidden', defaults.news.cover)" data-slot="news-cover">
      <MediaFrame :alt="post.title" :src="post.image" :class="cn('size-full', defaults.media.rounded)" />
      <Title
        :as="3"
        size="xs"
        weight="semibold"
        :class="cn(
          'pointer-events-none absolute inset-x-12 line-clamp-2 text-center leading-5 text-foreground',
          defaults.news.title
        )"
        data-slot="news-title"
      >
        {{ post.title }}
      </Title>
    </Box>
    <Group
      gap="2"
      align="center"
      :class="cn('w-full px-2 text-muted-foreground', defaults.news.strip)"
      data-slot="news-date"
    >
      <LucideIcon name="calendar" :size="16" />
      <Text size="xs" weight="bold" class="leading-4">
        {{ post.date }}
      </Text>
      <Text v-if="post.category" size="xs" weight="bold" class="leading-4">
        {{ post.category }}
      </Text>
    </Group>
  </Block>
  <Block v-else
    tag="article"
    :class="cn(
      'flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded',
      'h-full gap-4 overflow-hidden',
      (((layout as string) === 'horizontal') ? 'flex flex-col sm:flex-row' : 'flex flex-col')
    )"
    data-slot="card"
    :data-layout="layout"
    :data-meta="meta"
  >
    <Box
      v-if="((media as string) === 'image')"
      :class="cn('relative shrink-0', (((layout as string) === 'horizontal') ? 'sm:w-64' : ''))"
    >
      <MediaFrame :alt="post.title" :src="post.image" class="h-full" />
    </Box>
    <CardContent class="flex flex-1 flex-col gap-2">
      <Group v-if="((meta as string) !== 'news')" gap="2" align="center">
        <LucideIcon :name="post.icon" :size="16" />
        <Text size="xs" class="uppercase tracking-wide text-muted-foreground">
          {{ post.category }}
        </Text>
      </Group>
      <Title :as="3" size="xl" weight="bold">
        {{ post.title }}
      </Title>
      <Text
        v-if="(((density as string) === 'default') && ((meta as string) !== 'news'))"
        size="sm"
        class="text-muted-foreground"
      >
        {{ post.excerpt }}
      </Text>
      <Group v-if="((meta as string) !== 'news')" gap="2" class="mt-auto flex-wrap pt-2 text-muted-foreground">
        <Text v-if="((meta as string) === 'full')" size="xs">
          {{ tpl(labels.by, post.author) }}
        </Text>
        <Text size="xs">
          {{ post.date }}
        </Text>
        <Text v-if="((meta as string) === 'full')" size="xs">
          {{ tpl(labels.minutes, post.minutes) }}
        </Text>
      </Group>
      <Link
        v-if="(((meta as string) !== 'news') && post.href)"
        :href="urlOf(post.href)"
        variant="default"
        data-slot="read"
      >
        {{ labels.read }}
      </Link>
    </CardContent>
  </Block>
</template>

Vue registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdn
npx ui8kit add post-card
blocks/post-card.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A post as a card: cover picture, category, title, excerpt, author line and a read link. Axes: layout
 * (vertical, horizontal), media (image, none), meta (full, short: the date only, news: date and title only),
 * density.
 */
import { type JSX } from "solid-js";
import { Block, Box, CardContent, Group, Link, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { defaults } from "../presets/defaults";
import { cn, tpl, urlOf } from "../utils";
import type { Post, PostLabels } from "./post-card.types";

export type PostCardProps = {
  post: Post;
  labels: PostLabels;
  layout?: "vertical" | "horizontal";
  media?: "image" | "none";
  meta?: "full" | "short" | "news";
  density?: "default" | "compact";
};

export function PostCard({
  post,
  labels,
  layout = "vertical",
  media = "image",
  meta = "full",
  density = "default",
}: PostCardProps) {
  return (
    <>
      {((meta as string) === "news") ? (
        <Block
          tag="article"
          class={cn(
            "flex flex-col gap-2 overflow-hidden rounded p-0 inset-ring inset-ring-border",
            defaults.news.card
          )}
          data-layout={layout}
          data-meta="news"
          data-slot="item"
        >
          <Box class={cn("relative shrink-0 overflow-hidden", defaults.news.cover)} data-slot="news-cover">
            <MediaFrame alt={post.title} src={post.image} class={cn("size-full", defaults.media.rounded)} />
            <Title
              as={3}
              size="xs"
              weight="semibold"
              class={cn(
                "pointer-events-none absolute inset-x-12 line-clamp-2 text-center leading-5 text-foreground",
                defaults.news.title
              )}
              data-slot="news-title"
            >
              {post.title}
            </Title>
          </Box>
          <Group
            gap="2"
            align="center"
            class={cn("w-full px-2 text-muted-foreground", defaults.news.strip)}
            data-slot="news-date"
          >
            <LucideIcon name="calendar" size={16} />
            <Text size="xs" weight="bold" class="leading-4">
              {post.date}
            </Text>
            {post.category ? (
              <Text size="xs" weight="bold" class="leading-4">
                {post.category}
              </Text>
            ) : null}
          </Group>
        </Block>
      ) : (
        <Block
          tag="article"
          class={cn(
            "flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded",
            "h-full gap-4 overflow-hidden",
            (((layout as string) === "horizontal") ? "flex flex-col sm:flex-row" : "flex flex-col")
          )}
          data-slot="card"
          data-layout={layout}
          data-meta={meta}
        >
          {((media as string) === "image") ? (
            <Box class={cn("relative shrink-0", (((layout as string) === "horizontal") ? "sm:w-64" : ""))}>
              <MediaFrame alt={post.title} src={post.image} class="h-full" />
            </Box>
          ) : null}
          <CardContent class="flex flex-1 flex-col gap-2">
            {((meta as string) !== "news") ? (
              <Group gap="2" align="center">
                <LucideIcon name={post.icon} size={16} />
                <Text size="xs" class="uppercase tracking-wide text-muted-foreground">
                  {post.category}
                </Text>
              </Group>
            ) : null}
            <Title as={3} size="xl" weight="bold">
              {post.title}
            </Title>
            {(((density as string) === "default") && ((meta as string) !== "news")) ? (
              <Text size="sm" class="text-muted-foreground">
                {post.excerpt}
              </Text>
            ) : null}
            {((meta as string) !== "news") ? (
              <Group gap="2" class="mt-auto flex-wrap pt-2 text-muted-foreground">
                {((meta as string) === "full") ? (
                  <Text size="xs">
                    {tpl(labels.by, post.author)}
                  </Text>
                ) : null}
                <Text size="xs">
                  {post.date}
                </Text>
                {((meta as string) === "full") ? (
                  <Text size="xs">
                    {tpl(labels.minutes, post.minutes)}
                  </Text>
                ) : null}
              </Group>
            ) : null}
            {(((meta as string) !== "news") && post.href) ? (
              <Link href={urlOf(post.href)} variant="default" data-slot="read">
                {labels.read}
              </Link>
            ) : null}
          </CardContent>
        </Block>
      )}
    </>
  );
}
blocks/post-card.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Post = {
  id: string;
  title: string;
  excerpt: string;
  category: string;
  author: string;
  date: string;
  minutes: number;
  icon: string;
  href?: string;
  image?: string;
};

export type PostLabels = {
  minutes: string;
  by: string;
  read: string;
  empty: string;
};

Solid registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdn
npx ui8kit add post-card
blocks/post-card.templ
// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/post-card.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/icons"
	"github.com/ui8kit/codegen/generated/templ/ui/link"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// PostCardProps are the props of PostCard; the values are the JSON shapes of the TypeScript props.
type PostCardProps struct {
	Post any `json:"post"`
	Labels any `json:"labels"`
	Layout any `json:"layout"`
	Media any `json:"media"`
	Meta any `json:"meta"`
	Density any `json:"density"`
}

// A post as a card: cover picture, category, title, excerpt, author line and a read link. Axes: layout (vertical, horizontal), media (image, none), meta (full, short: the date only, news: date and title only), density.
templ PostCard(p PostCardProps) {
	{{ vPost := p.Post }}
	{{ vLabels := p.Labels }}
	{{ vLayout := uiutils.Def(p.Layout, "vertical") }}
	{{ vMedia := uiutils.Def(p.Media, "image") }}
	{{ vMeta := uiutils.Def(p.Meta, "full") }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	if uiutils.Eq(vMeta, "news") {
		@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "article", Class: uiutils.S(uiutils.Cnv("flex flex-col gap-2 overflow-hidden rounded p-0 inset-ring inset-ring-border", uiutils.Get(presetDefaults, "news", "card"))), Attrs: uiutils.Attrs("data-layout", vLayout, "data-meta", "news", "data-slot", "item")}}) {
			@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("relative shrink-0 overflow-hidden", uiutils.Get(presetDefaults, "news", "cover"))), Attrs: uiutils.Attrs("data-slot", "news-cover")}}) {
				@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vPost, "title"), Src: uiutils.Get(vPost, "image"), Class: uiutils.Cnv(uiutils.Cnv("size-full", uiutils.Get(presetDefaults, "media", "rounded")))})
				@compose.Title(compose.TitleProps{As: "3", Size: "xs", Weight: "semibold", TextProps: text.TextProps{Class: uiutils.S(uiutils.Cnv("pointer-events-none absolute inset-x-12 line-clamp-2 text-center leading-5 text-foreground", uiutils.Get(presetDefaults, "news", "title"))), Attrs: uiutils.Attrs("data-slot", "news-title")}}) {
					{ uiutils.Text(uiutils.Get(vPost, "title")) }
				}
			}
			@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("w-full px-2 text-muted-foreground", uiutils.Get(presetDefaults, "news", "strip"))), Attrs: uiutils.Attrs("data-slot", "news-date")}}) {
				@icons.LucideIcon(icons.LucideIconProps{Name: "calendar", Size: 16})
				@compose.Text(compose.TextProps{Size: "xs", Weight: "bold", TextProps: text.TextProps{Class: "leading-4"}}) {
					{ uiutils.Text(uiutils.Get(vPost, "date")) }
				}
				if uiutils.T(uiutils.Get(vPost, "category")) {
					@compose.Text(compose.TextProps{Size: "xs", Weight: "bold", TextProps: text.TextProps{Class: "leading-4"}}) {
						{ uiutils.Text(uiutils.Get(vPost, "category")) }
					}
				}
			}
		}
	} else {
		@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "article", Class: uiutils.S(uiutils.Cnv("flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded", "h-full gap-4 overflow-hidden", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "horizontal")), "flex flex-col sm:flex-row", "flex flex-col"))), Attrs: uiutils.Attrs("data-slot", "card", "data-layout", vLayout, "data-meta", vMeta)}}) {
			if uiutils.Eq(vMedia, "image") {
				@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("relative shrink-0", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "horizontal")), "sm:w-64", "")))}}) {
					@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vPost, "title"), Src: uiutils.Get(vPost, "image"), Class: uiutils.Cnv("h-full")})
				}
			}
			@compose.CardContent(compose.CardContentProps{BoxProps: box.BoxProps{Class: "flex flex-1 flex-col gap-2"}}) {
				if !uiutils.Eq(vMeta, "news") {
					@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{}}) {
						@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vPost, "icon")), Size: 16})
						@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "uppercase tracking-wide text-muted-foreground"}}) {
							{ uiutils.Text(uiutils.Get(vPost, "category")) }
						}
					}
				}
				@compose.Title(compose.TitleProps{As: "3", Size: "xl", Weight: "bold", TextProps: text.TextProps{}}) {
					{ uiutils.Text(uiutils.Get(vPost, "title")) }
				}
				if uiutils.T(uiutils.And(uiutils.Eq(vDensity, "default"), !uiutils.Eq(vMeta, "news"))) {
					@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
						{ uiutils.Text(uiutils.Get(vPost, "excerpt")) }
					}
				}
				if !uiutils.Eq(vMeta, "news") {
					@compose.Group(compose.GroupProps{Gap: "2", BoxProps: box.BoxProps{Class: "mt-auto flex-wrap pt-2 text-muted-foreground"}}) {
						if uiutils.Eq(vMeta, "full") {
							@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "by"), uiutils.Get(vPost, "author"))) }
							}
						}
						@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{}}) {
							{ uiutils.Text(uiutils.Get(vPost, "date")) }
						}
						if uiutils.Eq(vMeta, "full") {
							@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "minutes"), uiutils.Get(vPost, "minutes"))) }
							}
						}
					}
				}
				if uiutils.T(uiutils.And(!uiutils.Eq(vMeta, "news"), uiutils.Get(vPost, "href"))) {
					@compose.Link(compose.LinkProps{Variant: "default", LinkProps: link.LinkProps{Href: uiutils.URL(uiutils.Get(vPost, "href"), false), Attrs: uiutils.Attrs("data-slot", "read")}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "read")) }
					}
				}
			}
		}
	}
}

templ registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdn
npx ui8kit add post-card
blocks/post-card.html.twig
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/post-card.json
    A post as a card: cover picture, category, title, excerpt, author line and a read link. Axes: layout (vertical, horizontal), media (image, none), meta (full, short: the date only, news: date and title only), density.
    Props (p): post, labels, layout, media, meta, density. -#}
{%- set v_post = (p.post ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'vertical') -%}
{%- set v_media = (p.media ?? 'image') -%}
{%- set v_meta = (p.meta ?? 'full') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- if og_t(og_eq(v_meta, 'news')) %}
  {%- set c_6 -%}
    {%- set c_2 -%}
      {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_post, ['title']), 'src': og_get(v_post, ['image']), 'className': og_cnv([og_cnv(['size-full', og_preset('blocks/presets/defaults.json', ['media', 'rounded'])])])}}, with_context = false) }}
      {%- set c_1 -%}
        {{ og_text(og_get(v_post, ['title'])) }}
      {%- endset -%}
      {{ include('compose/Title.html.twig', {'as': 3, 'size': 'xs', 'weight': 'semibold', 'class': og_s(og_cnv(['pointer-events-none absolute inset-x-12 line-clamp-2 text-center leading-5 text-foreground', og_preset('blocks/presets/defaults.json', ['news', 'title'])])), 'attrs': og_attrs(['data-slot', 'news-title']), 'children': c_1}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['relative shrink-0 overflow-hidden', og_preset('blocks/presets/defaults.json', ['news', 'cover'])])), 'attrs': og_attrs(['data-slot', 'news-cover']), 'children': c_2}, with_context = false) }}
    {%- set c_5 -%}
      {{ include('icons/LucideIcon.html.twig', {'name': 'calendar', 'size': 16}, with_context = false) }}
      {%- set c_3 -%}
        {{ og_text(og_get(v_post, ['date'])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'xs', 'weight': 'bold', 'class': 'leading-4', 'children': c_3}, with_context = false) }}
      {%- if og_t(og_get(v_post, ['category'])) %}
        {%- set c_4 -%}
          {{ og_text(og_get(v_post, ['category'])) }}
        {%- endset -%}
        {{ include('compose/Text.html.twig', {'size': 'xs', 'weight': 'bold', 'class': 'leading-4', 'children': c_4}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'class': og_s(og_cnv(['w-full px-2 text-muted-foreground', og_preset('blocks/presets/defaults.json', ['news', 'strip'])])), 'attrs': og_attrs(['data-slot', 'news-date']), 'children': c_5}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Block.html.twig', {'tag': 'article', 'class': og_s(og_cnv(['flex flex-col gap-2 overflow-hidden rounded p-0 inset-ring inset-ring-border', og_preset('blocks/presets/defaults.json', ['news', 'card'])])), 'attrs': og_attrs(['data-layout', v_layout, 'data-meta', 'news', 'data-slot', 'item']), 'children': c_6}, with_context = false) }}
{%- else %}
  {%- set c_18 -%}
    {%- if og_t(og_eq(v_media, 'image')) %}
      {%- set c_7 -%}
        {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_post, ['title']), 'src': og_get(v_post, ['image']), 'className': og_cnv(['h-full'])}}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['relative shrink-0', (og_t(og_eq(v_layout, 'horizontal')) ? 'sm:w-64' : '')])), 'children': c_7}, with_context = false) }}
    {%- endif %}
    {%- set c_17 -%}
      {%- if og_t(not (og_eq(v_meta, 'news'))) %}
        {%- set c_9 -%}
          {{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_post, ['icon'])), 'size': 16}, with_context = false) }}
          {%- set c_8 -%}
            {{ og_text(og_get(v_post, ['category'])) }}
          {%- endset -%}
          {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'uppercase tracking-wide text-muted-foreground', 'children': c_8}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'children': c_9}, with_context = false) }}
      {%- endif %}
      {%- set c_10 -%}
        {{ og_text(og_get(v_post, ['title'])) }}
      {%- endset -%}
      {{ include('compose/Title.html.twig', {'as': 3, 'size': 'xl', 'weight': 'bold', 'children': c_10}, with_context = false) }}
      {%- if og_t(og_and([og_eq(v_density, 'default'), not (og_eq(v_meta, 'news'))])) %}
        {%- set c_11 -%}
          {{ og_text(og_get(v_post, ['excerpt'])) }}
        {%- endset -%}
        {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_11}, with_context = false) }}
      {%- endif %}
      {%- if og_t(not (og_eq(v_meta, 'news'))) %}
        {%- set c_15 -%}
          {%- if og_t(og_eq(v_meta, 'full')) %}
            {%- set c_12 -%}
              {{ og_text(og_tpl(og_get(v_labels, ['by']), [og_get(v_post, ['author'])])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'xs', 'children': c_12}, with_context = false) }}
          {%- endif %}
          {%- set c_13 -%}
            {{ og_text(og_get(v_post, ['date'])) }}
          {%- endset -%}
          {{ include('compose/Text.html.twig', {'size': 'xs', 'children': c_13}, with_context = false) }}
          {%- if og_t(og_eq(v_meta, 'full')) %}
            {%- set c_14 -%}
              {{ og_text(og_tpl(og_get(v_labels, ['minutes']), [og_get(v_post, ['minutes'])])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'xs', 'children': c_14}, with_context = false) }}
          {%- endif %}
        {%- endset -%}
        {{ include('compose/Group.html.twig', {'gap': '2', 'class': 'mt-auto flex-wrap pt-2 text-muted-foreground', 'children': c_15}, with_context = false) }}
      {%- endif %}
      {%- if og_t(og_and([not (og_eq(v_meta, 'news')), og_get(v_post, ['href'])])) %}
        {%- set c_16 -%}
          {{ og_text(og_get(v_labels, ['read'])) }}
        {%- endset -%}
        {{ include('compose/Link.html.twig', {'href': og_url(og_s(og_get(v_post, ['href']))), 'variant': 'default', 'attrs': og_attrs(['data-slot', 'read']), 'children': c_16}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('compose/CardContent.html.twig', {'class': 'flex flex-1 flex-col gap-2', 'children': c_17}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Block.html.twig', {'tag': 'article', 'class': og_s(og_cnv(['flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded', 'h-full gap-4 overflow-hidden', (og_t(og_eq(v_layout, 'horizontal')) ? 'flex flex-col sm:flex-row' : 'flex flex-col')])), 'attrs': og_attrs(['data-slot', 'card', 'data-layout', v_layout, 'data-meta', v_meta]), 'children': c_18}, with_context = false) }}
{%- endif %}

Twig registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdn
npx ui8kit add post-card
blocks/post-card.latte
{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/post-card.json
    A post as a card: cover picture, category, title, excerpt, author line and a read link. Axes: layout (vertical, horizontal), media (image, none), meta (full, short: the date only, news: date and title only), density.
    Props (p): post, labels, layout, media, meta, density. *}
{var $v_post = ($p['post'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'vertical')}
{var $v_media = ($p['media'] ?? 'image')}
{var $v_meta = ($p['meta'] ?? 'full')}
{var $v_density = ($p['density'] ?? 'default')}
{if og_t(og_eq($v_meta, 'news'))}
  {capture $c_6}
    {capture $c_2}
      {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_post, ['title']), 'src' => og_get($v_post, ['image']), 'className' => og_cnv([og_cnv(['size-full', og_preset('blocks/presets/defaults.json', ['media', 'rounded'])])])]])|noescape}
      {capture $c_1}
        {=og_text(og_get($v_post, ['title']))}
      {/capture}
      {=og_include('compose/Title.latte', ['as' => 3, 'size' => 'xs', 'weight' => 'semibold', 'class' => og_s(og_cnv(['pointer-events-none absolute inset-x-12 line-clamp-2 text-center leading-5 text-foreground', og_preset('blocks/presets/defaults.json', ['news', 'title'])])), 'attrs' => og_attrs(['data-slot', 'news-title']), 'children' => (string) $c_1])|noescape}
    {/capture}
    {=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['relative shrink-0 overflow-hidden', og_preset('blocks/presets/defaults.json', ['news', 'cover'])])), 'attrs' => og_attrs(['data-slot', 'news-cover']), 'children' => (string) $c_2])|noescape}
    {capture $c_5}
      {=og_include('icons/LucideIcon.latte', ['name' => 'calendar', 'size' => 16])|noescape}
      {capture $c_3}
        {=og_text(og_get($v_post, ['date']))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'xs', 'weight' => 'bold', 'class' => 'leading-4', 'children' => (string) $c_3])|noescape}
      {if og_t(og_get($v_post, ['category']))}
        {capture $c_4}
          {=og_text(og_get($v_post, ['category']))}
        {/capture}
        {=og_include('compose/Text.latte', ['size' => 'xs', 'weight' => 'bold', 'class' => 'leading-4', 'children' => (string) $c_4])|noescape}
      {/if}
    {/capture}
    {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'class' => og_s(og_cnv(['w-full px-2 text-muted-foreground', og_preset('blocks/presets/defaults.json', ['news', 'strip'])])), 'attrs' => og_attrs(['data-slot', 'news-date']), 'children' => (string) $c_5])|noescape}
  {/capture}
  {=og_include('compose/Block.latte', ['tag' => 'article', 'class' => og_s(og_cnv(['flex flex-col gap-2 overflow-hidden rounded p-0 inset-ring inset-ring-border', og_preset('blocks/presets/defaults.json', ['news', 'card'])])), 'attrs' => og_attrs(['data-layout', $v_layout, 'data-meta', 'news', 'data-slot', 'item']), 'children' => (string) $c_6])|noescape}
{else}
  {capture $c_18}
    {if og_t(og_eq($v_media, 'image'))}
      {capture $c_7}
        {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_post, ['title']), 'src' => og_get($v_post, ['image']), 'className' => og_cnv(['h-full'])]])|noescape}
      {/capture}
      {=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['relative shrink-0', (og_t(og_eq($v_layout, 'horizontal')) ? 'sm:w-64' : '')])), 'children' => (string) $c_7])|noescape}
    {/if}
    {capture $c_17}
      {if og_t(!(og_eq($v_meta, 'news')))}
        {capture $c_9}
          {=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_post, ['icon'])), 'size' => 16])|noescape}
          {capture $c_8}
            {=og_text(og_get($v_post, ['category']))}
          {/capture}
          {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'uppercase tracking-wide text-muted-foreground', 'children' => (string) $c_8])|noescape}
        {/capture}
        {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'children' => (string) $c_9])|noescape}
      {/if}
      {capture $c_10}
        {=og_text(og_get($v_post, ['title']))}
      {/capture}
      {=og_include('compose/Title.latte', ['as' => 3, 'size' => 'xl', 'weight' => 'bold', 'children' => (string) $c_10])|noescape}
      {if og_t(og_and([og_eq($v_density, 'default'), !(og_eq($v_meta, 'news'))]))}
        {capture $c_11}
          {=og_text(og_get($v_post, ['excerpt']))}
        {/capture}
        {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_11])|noescape}
      {/if}
      {if og_t(!(og_eq($v_meta, 'news')))}
        {capture $c_15}
          {if og_t(og_eq($v_meta, 'full'))}
            {capture $c_12}
              {=og_text(og_tpl(og_get($v_labels, ['by']), [og_get($v_post, ['author'])]))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'xs', 'children' => (string) $c_12])|noescape}
          {/if}
          {capture $c_13}
            {=og_text(og_get($v_post, ['date']))}
          {/capture}
          {=og_include('compose/Text.latte', ['size' => 'xs', 'children' => (string) $c_13])|noescape}
          {if og_t(og_eq($v_meta, 'full'))}
            {capture $c_14}
              {=og_text(og_tpl(og_get($v_labels, ['minutes']), [og_get($v_post, ['minutes'])]))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'xs', 'children' => (string) $c_14])|noescape}
          {/if}
        {/capture}
        {=og_include('compose/Group.latte', ['gap' => '2', 'class' => 'mt-auto flex-wrap pt-2 text-muted-foreground', 'children' => (string) $c_15])|noescape}
      {/if}
      {if og_t(og_and([!(og_eq($v_meta, 'news')), og_get($v_post, ['href'])]))}
        {capture $c_16}
          {=og_text(og_get($v_labels, ['read']))}
        {/capture}
        {=og_include('compose/Link.latte', ['href' => og_url(og_s(og_get($v_post, ['href']))), 'variant' => 'default', 'attrs' => og_attrs(['data-slot', 'read']), 'children' => (string) $c_16])|noescape}
      {/if}
    {/capture}
    {=og_include('compose/CardContent.latte', ['class' => 'flex flex-1 flex-col gap-2', 'children' => (string) $c_17])|noescape}
  {/capture}
  {=og_include('compose/Block.latte', ['tag' => 'article', 'class' => og_s(og_cnv(['flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded', 'h-full gap-4 overflow-hidden', (og_t(og_eq($v_layout, 'horizontal')) ? 'flex flex-col sm:flex-row' : 'flex flex-col')])), 'attrs' => og_attrs(['data-slot', 'card', 'data-layout', $v_layout, 'data-meta', $v_meta]), 'children' => (string) $c_18])|noescape}
{/if}

Latte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdn
npx ui8kit add post-card
blocks/post-card.html.j2
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/post-card.json
    A post as a card: cover picture, category, title, excerpt, author line and a read link. Axes: layout (vertical, horizontal), media (image, none), meta (full, short: the date only, news: date and title only), density.
    Props (p): post, labels, layout, media, meta, density. -#}
{%- set v_post = og_def(p['post'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'vertical') -%}
{%- set v_media = og_def(p['media'], 'image') -%}
{%- set v_meta = og_def(p['meta'], 'full') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- if og_t(og_eq(v_meta, 'news')) %}
  {%- set c_6 -%}
    {%- set c_2 -%}
      {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_post, ['title']), 'src': og_get(v_post, ['image']), 'className': og_cnv([og_cnv(['size-full', og_preset('blocks/presets/defaults.json', ['media', 'rounded'])])])}}) }}
      {%- set c_1 -%}
        {{ og_text(og_get(v_post, ['title'])) }}
      {%- endset -%}
      {{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'xs', 'Weight': 'semibold', 'Class': og_s(og_cnv(['pointer-events-none absolute inset-x-12 line-clamp-2 text-center leading-5 text-foreground', og_preset('blocks/presets/defaults.json', ['news', 'title'])])), 'Attrs': og_attrs(['data-slot', 'news-title'])}, 'children': c_1}) }}
    {%- endset -%}
    {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['relative shrink-0 overflow-hidden', og_preset('blocks/presets/defaults.json', ['news', 'cover'])])), 'Attrs': og_attrs(['data-slot', 'news-cover'])}, 'children': c_2}) }}
    {%- set c_5 -%}
      {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'calendar', 'Size': 16}}) }}
      {%- set c_3 -%}
        {{ og_text(og_get(v_post, ['date'])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Weight': 'bold', 'Class': 'leading-4'}, 'children': c_3}) }}
      {%- if og_t(og_get(v_post, ['category'])) %}
        {%- set c_4 -%}
          {{ og_text(og_get(v_post, ['category'])) }}
        {%- endset -%}
        {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Weight': 'bold', 'Class': 'leading-4'}, 'children': c_4}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Class': og_s(og_cnv(['w-full px-2 text-muted-foreground', og_preset('blocks/presets/defaults.json', ['news', 'strip'])])), 'Attrs': og_attrs(['data-slot', 'news-date'])}, 'children': c_5}) }}
  {%- endset -%}
  {{ og_include('compose/block.html.j2', {'p': {'Tag': 'article', 'Class': og_s(og_cnv(['flex flex-col gap-2 overflow-hidden rounded p-0 inset-ring inset-ring-border', og_preset('blocks/presets/defaults.json', ['news', 'card'])])), 'Attrs': og_attrs(['data-layout', v_layout, 'data-meta', 'news', 'data-slot', 'item'])}, 'children': c_6}) }}
{%- else %}
  {%- set c_18 -%}
    {%- if og_t(og_eq(v_media, 'image')) %}
      {%- set c_7 -%}
        {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_post, ['title']), 'src': og_get(v_post, ['image']), 'className': og_cnv(['h-full'])}}) }}
      {%- endset -%}
      {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['relative shrink-0', ('sm:w-64' if og_t(og_eq(v_layout, 'horizontal')) else '')]))}, 'children': c_7}) }}
    {%- endif %}
    {%- set c_17 -%}
      {%- if og_t(not (og_eq(v_meta, 'news'))) %}
        {%- set c_9 -%}
          {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_post, ['icon'])), 'Size': 16}}) }}
          {%- set c_8 -%}
            {{ og_text(og_get(v_post, ['category'])) }}
          {%- endset -%}
          {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'uppercase tracking-wide text-muted-foreground'}, 'children': c_8}) }}
        {%- endset -%}
        {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center'}, 'children': c_9}) }}
      {%- endif %}
      {%- set c_10 -%}
        {{ og_text(og_get(v_post, ['title'])) }}
      {%- endset -%}
      {{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'xl', 'Weight': 'bold'}, 'children': c_10}) }}
      {%- if og_t(og_and([og_eq(v_density, 'default'), not (og_eq(v_meta, 'news'))])) %}
        {%- set c_11 -%}
          {{ og_text(og_get(v_post, ['excerpt'])) }}
        {%- endset -%}
        {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_11}) }}
      {%- endif %}
      {%- if og_t(not (og_eq(v_meta, 'news'))) %}
        {%- set c_15 -%}
          {%- if og_t(og_eq(v_meta, 'full')) %}
            {%- set c_12 -%}
              {{ og_text(og_tpl(og_get(v_labels, ['by']), [og_get(v_post, ['author'])])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs'}, 'children': c_12}) }}
          {%- endif %}
          {%- set c_13 -%}
            {{ og_text(og_get(v_post, ['date'])) }}
          {%- endset -%}
          {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs'}, 'children': c_13}) }}
          {%- if og_t(og_eq(v_meta, 'full')) %}
            {%- set c_14 -%}
              {{ og_text(og_tpl(og_get(v_labels, ['minutes']), [og_get(v_post, ['minutes'])])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs'}, 'children': c_14}) }}
          {%- endif %}
        {%- endset -%}
        {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Class': 'mt-auto flex-wrap pt-2 text-muted-foreground'}, 'children': c_15}) }}
      {%- endif %}
      {%- if og_t(og_and([not (og_eq(v_meta, 'news')), og_get(v_post, ['href'])])) %}
        {%- set c_16 -%}
          {{ og_text(og_get(v_labels, ['read'])) }}
        {%- endset -%}
        {{ og_include('compose/link.html.j2', {'p': {'Href': og_url(og_s(og_get(v_post, ['href']))), 'Variant': 'default', 'Attrs': og_attrs(['data-slot', 'read'])}, 'children': c_16}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('compose/card-content.html.j2', {'p': {'Class': 'flex flex-1 flex-col gap-2'}, 'children': c_17}) }}
  {%- endset -%}
  {{ og_include('compose/block.html.j2', {'p': {'Tag': 'article', 'Class': og_s(og_cnv(['flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded', 'h-full gap-4 overflow-hidden', ('flex flex-col sm:flex-row' if og_t(og_eq(v_layout, 'horizontal')) else 'flex flex-col')])), 'Attrs': og_attrs(['data-slot', 'card', 'data-layout', v_layout, 'data-meta', v_meta])}, 'children': c_18}) }}
{%- endif %}

Jinja2 registry item (JSON)

Props

Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.

A post as a card: cover picture, category, title, excerpt, author line and a read link. Axes: layout (vertical, horizontal), media (image, none), meta (full, short: the date only, news: date and title only), density.

Props of PostCard
PropTypeDefault Description
post (required)Post-
labels (required)PostLabels-templates: minutes `{0} min read`, by `By {0}`; and the word of the read link
layout "vertical" | "horizontal""vertical"
media "image" | "none""image"
meta "full" | "short" | "news""full"
density "default" | "compact""default"

Used in