Post Overlay Card
Post Overlay Card component
Install
npx ui8kit add post-overlay-cardPulls in: badge, box, compose, group, kit-box, kit-text, lucide-icon, media-frame, menu-entry, post-card, stack, text, title, utils
Preview
Mar 18, 2026
Why static-first pages still win
Less script, less waiting, and pages that keep working offline.
Read the postCode
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-cdnnpx ui8kit add post-overlay-card<!-- 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 card of PostShowcase with the text on a panel over the lower part of the picture: the category and
date, the title, the excerpt and a read link.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Post, PostLabels } from "../blocks/post-card.types";
export type PostOverlayCardProps = {
p: Post;
labels: PostLabels;
ratio?: "4/3" | "16/9";
};
</script>
<script lang="ts">
import Badge from "../compose/Badge.svelte";
import Box from "../compose/Box.svelte";
import Group from "../compose/Group.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import Title from "../compose/Title.svelte";
import MediaFrame from "../components/media-frame.svelte";
import MenuEntry from "../components/menu-entry.svelte";
import { cn } from "../utils";
let { p, labels, ratio = "4/3" }: PostOverlayCardProps = $props();
</script>
<Box class="relative overflow-hidden rounded" data-slot="post-overlay">
<MediaFrame
alt={p.title}
src={p.image}
ratio={ratio}
class={(((ratio as string) === "4/3") ? "min-h-80" : "min-h-64")}
/>
<Stack gap="2" align="start" class="absolute bottom-4 left-4 right-4 rounded bg-background p-4">
<Group gap="2" align="center">
<Badge variant="secondary" size="sm">
{p.category}
</Badge>
<Text size="xs" class="text-muted-foreground">
{p.date}
</Text>
</Group>
<Title as={3} size="base" weight="semibold">
{p.title}
</Title>
<Text size="sm" class={cn("text-muted-foreground", "line-clamp-2")}>
{p.excerpt}
</Text>
<MenuEntry href={p.href} class="gap-2 text-sm font-medium" size="sm" testid="read">
{labels.read}
<LucideIcon name="arrow-right" size={16} />
</MenuEntry>
</Stack>
</Box>
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-cdnnpx ui8kit add post-overlay-card// 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 card of PostShowcase with the text on a panel over the lower part of the picture: the category and
* date, the title, the excerpt and a read link.
*/
import { type ReactNode } from "react";
import { Badge, Box, Group, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { MenuEntry } from "../components/menu-entry";
import { cn } from "../utils";
import type { Post, PostLabels } from "../blocks/post-card.types";
export type PostOverlayCardProps = {
p: Post;
labels: PostLabels;
ratio?: "4/3" | "16/9";
};
export function PostOverlayCard({ p, labels, ratio = "4/3" }: PostOverlayCardProps) {
return (
<Box className="relative overflow-hidden rounded" data-slot="post-overlay">
<MediaFrame
alt={p.title}
src={p.image}
ratio={ratio}
className={(((ratio as string) === "4/3") ? "min-h-80" : "min-h-64")}
/>
<Stack gap="2" align="start" className="absolute bottom-4 left-4 right-4 rounded bg-background p-4">
<Group gap="2" align="center">
<Badge variant="secondary" size="sm">
{p.category}
</Badge>
<Text size="xs" className="text-muted-foreground">
{p.date}
</Text>
</Group>
<Title as={3} size="base" weight="semibold">
{p.title}
</Title>
<Text size="sm" className={cn("text-muted-foreground", "line-clamp-2")}>
{p.excerpt}
</Text>
<MenuEntry href={p.href} className="gap-2 text-sm font-medium" size="sm" testid="read">
{labels.read}
<LucideIcon name="arrow-right" size={16} />
</MenuEntry>
</Stack>
</Box>
);
}
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-cdnnpx ui8kit add post-overlay-card<!-- 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 card of PostShowcase with the text on a panel over the lower part of the picture: the category and
date, the title, the excerpt and a read link.
-->
<script lang="ts">
import type { Post, PostLabels } from "../blocks/post-card.types";
export type PostOverlayCardProps = {
p: Post;
labels: PostLabels;
ratio?: "4/3" | "16/9";
};
</script>
<script setup lang="ts">
import Badge from "../compose/Badge.vue";
import Box from "../compose/Box.vue";
import Group from "../compose/Group.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import MediaFrame from "../components/media-frame.vue";
import MenuEntry from "../components/menu-entry.vue";
import { cn } from "../utils";
const { p, labels, ratio = "4/3" } = defineProps<PostOverlayCardProps>();
</script>
<template>
<Box class="relative overflow-hidden rounded" data-slot="post-overlay">
<MediaFrame
:alt="p.title"
:src="p.image"
:ratio="ratio"
:class="(((ratio as string) === '4/3') ? 'min-h-80' : 'min-h-64')"
/>
<Stack gap="2" align="start" class="absolute bottom-4 left-4 right-4 rounded bg-background p-4">
<Group gap="2" align="center">
<Badge variant="secondary" size="sm">
{{ p.category }}
</Badge>
<Text size="xs" class="text-muted-foreground">
{{ p.date }}
</Text>
</Group>
<Title :as="3" size="base" weight="semibold">
{{ p.title }}
</Title>
<Text size="sm" :class="cn('text-muted-foreground', 'line-clamp-2')">
{{ p.excerpt }}
</Text>
<MenuEntry :href="p.href" class="gap-2 text-sm font-medium" size="sm" testid="read">
{{ labels.read }}
<LucideIcon name="arrow-right" :size="16" />
</MenuEntry>
</Stack>
</Box>
</template>
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-cdnnpx ui8kit add post-overlay-card// 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 card of PostShowcase with the text on a panel over the lower part of the picture: the category and
* date, the title, the excerpt and a read link.
*/
import { type JSX } from "solid-js";
import { Badge, Box, Group, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { MenuEntry } from "../components/menu-entry";
import { cn } from "../utils";
import type { Post, PostLabels } from "../blocks/post-card.types";
export type PostOverlayCardProps = {
p: Post;
labels: PostLabels;
ratio?: "4/3" | "16/9";
};
export function PostOverlayCard({ p, labels, ratio = "4/3" }: PostOverlayCardProps) {
return (
<Box class="relative overflow-hidden rounded" data-slot="post-overlay">
<MediaFrame
alt={p.title}
src={p.image}
ratio={ratio}
class={(((ratio as string) === "4/3") ? "min-h-80" : "min-h-64")}
/>
<Stack gap="2" align="start" class="absolute bottom-4 left-4 right-4 rounded bg-background p-4">
<Group gap="2" align="center">
<Badge variant="secondary" size="sm">
{p.category}
</Badge>
<Text size="xs" class="text-muted-foreground">
{p.date}
</Text>
</Group>
<Title as={3} size="base" weight="semibold">
{p.title}
</Title>
<Text size="sm" class={cn("text-muted-foreground", "line-clamp-2")}>
{p.excerpt}
</Text>
<MenuEntry href={p.href} class="gap-2 text-sm font-medium" size="sm" testid="read">
{labels.read}
<LucideIcon name="arrow-right" size={16} />
</MenuEntry>
</Stack>
</Box>
);
}
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-cdnnpx ui8kit add post-overlay-card// 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-overlay-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/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// PostOverlayCardProps are the props of PostOverlayCard; the values are the JSON shapes of the TypeScript props.
type PostOverlayCardProps struct {
P any `json:"p"`
Labels any `json:"labels"`
Ratio any `json:"ratio"`
}
// A post card of PostShowcase with the text on a panel over the lower part of the picture: the category and date, the title, the excerpt and a read link.
templ PostOverlayCard(p PostOverlayCardProps) {
{{ vP := p.P }}
{{ vLabels := p.Labels }}
{{ vRatio := uiutils.Def(p.Ratio, "4/3") }}
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "relative overflow-hidden rounded", Attrs: uiutils.Attrs("data-slot", "post-overlay")}}) {
@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vP, "title"), Src: uiutils.Get(vP, "image"), Ratio: vRatio, Class: uiutils.Cnv(uiutils.Cond(uiutils.T(uiutils.Eq(vRatio, "4/3")), "min-h-80", "min-h-64"))})
@compose.Stack(compose.StackProps{Gap: "2", Align: "start", BoxProps: box.BoxProps{Class: "absolute bottom-4 left-4 right-4 rounded bg-background p-4"}}) {
@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{}}) {
@compose.Badge(compose.BadgeProps{Variant: "secondary", Size: "sm", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vP, "category")) }
}
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vP, "date")) }
}
}
@compose.Title(compose.TitleProps{As: "3", Size: "base", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vP, "title")) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: uiutils.S(uiutils.Cnv("text-muted-foreground", "line-clamp-2"))}}) {
{ uiutils.Text(uiutils.Get(vP, "excerpt")) }
}
@MenuEntry(MenuEntryProps{Href: uiutils.Get(vP, "href"), Class: uiutils.Cnv("gap-2 text-sm font-medium"), Size: "sm", Testid: "read"}) {
{ uiutils.Text(uiutils.Get(vLabels, "read")) }
@icons.LucideIcon(icons.LucideIconProps{Name: "arrow-right", Size: 16})
}
}
}
}
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-cdnnpx ui8kit add post-overlay-card{#- 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-overlay-card.json
A post card of PostShowcase with the text on a panel over the lower part of the picture: the category and date, the title, the excerpt and a read link.
Props (p): p, labels, ratio. -#}
{%- set v_p = (p.p ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_ratio = (p.ratio ?? '4/3') -%}
{%- set c_8 -%}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_p, ['title']), 'src': og_get(v_p, ['image']), 'ratio': v_ratio, 'className': og_cnv([(og_t(og_eq(v_ratio, '4/3')) ? 'min-h-80' : 'min-h-64')])}}, with_context = false) }}
{%- set c_7 -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_p, ['category'])) }}
{%- endset -%}
{{ include('compose/Badge.html.twig', {'variant': 'secondary', 'size': 'sm', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_get(v_p, ['date'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'children': c_3}, with_context = false) }}
{%- set c_4 -%}
{{ og_text(og_get(v_p, ['title'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'base', 'weight': 'semibold', 'children': c_4}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_get(v_p, ['excerpt'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': og_s(og_cnv(['text-muted-foreground', 'line-clamp-2'])), 'children': c_5}, with_context = false) }}
{%- set c_6 -%}
{{ og_text(og_get(v_labels, ['read'])) }}
{{ include('icons/LucideIcon.html.twig', {'name': 'arrow-right', 'size': 16}, with_context = false) }}
{%- endset -%}
{{ include('blocks/menu-entry.html.twig', {'p': {'href': og_get(v_p, ['href']), 'className': og_cnv(['gap-2 text-sm font-medium']), 'size': 'sm', 'testid': 'read'}, 'children': og_markup(c_6)}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'align': 'start', 'class': 'absolute bottom-4 left-4 right-4 rounded bg-background p-4', 'children': c_7}, with_context = false) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'relative overflow-hidden rounded', 'attrs': og_attrs(['data-slot', 'post-overlay']), 'children': c_8}, with_context = false) }}
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-cdnnpx ui8kit add post-overlay-card{* 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-overlay-card.json
A post card of PostShowcase with the text on a panel over the lower part of the picture: the category and date, the title, the excerpt and a read link.
Props (p): p, labels, ratio. *}
{var $v_p = ($p['p'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_ratio = ($p['ratio'] ?? '4/3')}
{capture $c_8}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_p, ['title']), 'src' => og_get($v_p, ['image']), 'ratio' => $v_ratio, 'className' => og_cnv([(og_t(og_eq($v_ratio, '4/3')) ? 'min-h-80' : 'min-h-64')])]])|noescape}
{capture $c_7}
{capture $c_3}
{capture $c_1}
{=og_text(og_get($v_p, ['category']))}
{/capture}
{=og_include('compose/Badge.latte', ['variant' => 'secondary', 'size' => 'sm', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_text(og_get($v_p, ['date']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'children' => (string) $c_3])|noescape}
{capture $c_4}
{=og_text(og_get($v_p, ['title']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'base', 'weight' => 'semibold', 'children' => (string) $c_4])|noescape}
{capture $c_5}
{=og_text(og_get($v_p, ['excerpt']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => og_s(og_cnv(['text-muted-foreground', 'line-clamp-2'])), 'children' => (string) $c_5])|noescape}
{capture $c_6}
{=og_text(og_get($v_labels, ['read']))}
{=og_include('icons/LucideIcon.latte', ['name' => 'arrow-right', 'size' => 16])|noescape}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_p, ['href']), 'className' => og_cnv(['gap-2 text-sm font-medium']), 'size' => 'sm', 'testid' => 'read'], 'children' => og_markup($c_6)])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'align' => 'start', 'class' => 'absolute bottom-4 left-4 right-4 rounded bg-background p-4', 'children' => (string) $c_7])|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'relative overflow-hidden rounded', 'attrs' => og_attrs(['data-slot', 'post-overlay']), 'children' => (string) $c_8])|noescape}
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-cdnnpx ui8kit add post-overlay-card{#- 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-overlay-card.json
A post card of PostShowcase with the text on a panel over the lower part of the picture: the category and date, the title, the excerpt and a read link.
Props (p): p, labels, ratio. -#}
{%- set v_p = og_def(p['p'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_ratio = og_def(p['ratio'], '4/3') -%}
{%- set c_8 -%}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_p, ['title']), 'src': og_get(v_p, ['image']), 'ratio': v_ratio, 'className': og_cnv([('min-h-80' if og_t(og_eq(v_ratio, '4/3')) else 'min-h-64')])}}) }}
{%- set c_7 -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_p, ['category'])) }}
{%- endset -%}
{{ og_include('compose/badge.html.j2', {'p': {'Variant': 'secondary', 'Size': 'sm'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_text(og_get(v_p, ['date'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center'}, 'children': c_3}) }}
{%- set c_4 -%}
{{ og_text(og_get(v_p, ['title'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'base', 'Weight': 'semibold'}, 'children': c_4}) }}
{%- set c_5 -%}
{{ og_text(og_get(v_p, ['excerpt'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': og_s(og_cnv(['text-muted-foreground', 'line-clamp-2']))}, 'children': c_5}) }}
{%- set c_6 -%}
{{ og_text(og_get(v_labels, ['read'])) }}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'arrow-right', 'Size': 16}}) }}
{%- endset -%}
{{ og_include('blocks/menu-entry.html.j2', {'p': {'href': og_get(v_p, ['href']), 'className': og_cnv(['gap-2 text-sm font-medium']), 'size': 'sm', 'testid': 'read'}, 'children': og_markup(c_6)}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Align': 'start', 'Class': 'absolute bottom-4 left-4 right-4 rounded bg-background p-4'}, 'children': c_7}) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'relative overflow-hidden rounded', 'Attrs': og_attrs(['data-slot', 'post-overlay'])}, 'children': c_8}) }}
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 card of PostShowcase with the text on a panel over the lower part of the picture: the category and date, the title, the excerpt and a read link.
| Prop | Type | Default | Description |
|---|---|---|---|
| p (required) | Post | - | |
| labels (required) | PostLabels | - | templates: minutes `{0} min read`, by `By {0}`; and the word of the read link |
| ratio | "4/3" | "16/9" | "4/3" |