Feature Showcase
Cards with a picture on top and a read link, or with a muted glyph panel on top like an index of categories, in three or four columns.
Install
npx ui8kit add feature-showcasePulls in: box, card, card-content, compose, empty-state, feature-grid, kit-box, kit-text, lucide-icon, media-frame, menu-entry, section-frame, text, title, utils
Preview
Everything in one place
Each part does one job well, and they all work together.
Craft over speed
We ship when it is right, then we ship often.
Learn moreWork in the open
Plans, notes and numbers are shared with the whole team.
Learn moreCare for the reader
Every page is written for the person who has to use it.
Learn moreCode
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 feature-showcase<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Features as cards under a centered heading. Axes: item (picture: a picture on top, then the title, the text
and a read link; panel: a muted panel with a large glyph on top, then the title and the text), cols (3, 4),
tone.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Feature } from "./feature-grid.types";
export type FeatureShowcaseProps = {
id: string;
title: string;
lead?: string;
features: Feature[];
empty?: string;
more: string;
item?: "picture" | "panel";
cols?: "3" | "4";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Card from "../compose/Card.svelte";
import CardContent from "../compose/CardContent.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Text from "../compose/Text.svelte";
import Title from "../compose/Title.svelte";
import EmptyState from "../components/empty-state.svelte";
import MediaFrame from "../components/media-frame.svelte";
import MenuEntry from "../components/menu-entry.svelte";
import SectionFrame from "../components/section-frame.svelte";
let {
id,
title,
lead = "",
features,
empty = "",
more,
item = "picture",
cols = "3",
tone = "default",
landmarkLabel,
}: FeatureShowcaseProps = $props();
</script>
<SectionFrame id={id} title={title} lead={lead} tone={tone} align="center" landmarkLabel={landmarkLabel}>
{#if ((features?.length ?? 0) === 0)}
<EmptyState icon="layout-grid" title={empty} />
{:else}
<Box
class={
(cols as string) === "4" ? "grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-4"
: "grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-3"
}
>
{#each features as f (f.id)}
<Card variant="default" class="h-full gap-4 overflow-hidden">
{#if ((item as string) === "picture")}
<MediaFrame alt={f.title} src={f.image} />
{:else}
<Box
class="flex aspect-video items-center justify-center rounded bg-muted text-foreground"
data-slot="showcase-panel"
>
<LucideIcon name={f.icon} size={32} />
</Box>
{/if}
<CardContent class="flex flex-1 flex-col gap-2">
<Title as={3} size="base" weight="semibold">
{f.title}
</Title>
<Text size="sm" class="text-muted-foreground">
{f.text}
</Text>
{#if ((item as string) === "picture")}
<MenuEntry href={f.href} class="mt-auto gap-2 pt-2 text-sm font-medium" size="sm" testid="read">
{more}
<LucideIcon name="arrow-right" size={16} />
</MenuEntry>
{/if}
</CardContent>
</Card>
{/each}
</Box>
{/if}
</SectionFrame>
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 feature-showcase// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Features as cards under a centered heading. Axes: item (picture: a picture on top, then the title, the text
* and a read link; panel: a muted panel with a large glyph on top, then the title and the text), cols (3, 4),
* tone.
*/
import { type ReactNode } from "react";
import { Box, Card, CardContent, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { MenuEntry } from "../components/menu-entry";
import { SectionFrame } from "../components/section-frame";
import type { Feature } from "./feature-grid.types";
export type FeatureShowcaseProps = {
id: string;
title: string;
lead?: string;
features: Feature[];
empty?: string;
more: string;
item?: "picture" | "panel";
cols?: "3" | "4";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function FeatureShowcase({
id,
title,
lead = "",
features,
empty = "",
more,
item = "picture",
cols = "3",
tone = "default",
landmarkLabel,
}: FeatureShowcaseProps) {
return (
<SectionFrame id={id} title={title} lead={lead} tone={tone} align="center" landmarkLabel={landmarkLabel}>
{((features?.length ?? 0) === 0) ? (
<EmptyState icon="layout-grid" title={empty} />
) : (
<Box
className={
(cols as string) === "4" ? "grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-4"
: "grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-3"
}
>
{(features ?? []).map((f) => (
<Card key={f.id} variant="default" className="h-full gap-4 overflow-hidden">
{((item as string) === "picture") ? (
<MediaFrame alt={f.title} src={f.image} />
) : (
<Box
className="flex aspect-video items-center justify-center rounded bg-muted text-foreground"
data-slot="showcase-panel"
>
<LucideIcon name={f.icon} size={32} />
</Box>
)}
<CardContent className="flex flex-1 flex-col gap-2">
<Title as={3} size="base" weight="semibold">
{f.title}
</Title>
<Text size="sm" className="text-muted-foreground">
{f.text}
</Text>
{((item as string) === "picture") ? (
<MenuEntry href={f.href} className="mt-auto gap-2 pt-2 text-sm font-medium" size="sm" testid="read">
{more}
<LucideIcon name="arrow-right" size={16} />
</MenuEntry>
) : null}
</CardContent>
</Card>
))}
</Box>
)}
</SectionFrame>
);
}
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 feature-showcase<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Features as cards under a centered heading. Axes: item (picture: a picture on top, then the title, the text
and a read link; panel: a muted panel with a large glyph on top, then the title and the text), cols (3, 4),
tone.
-->
<script lang="ts">
import type { Feature } from "./feature-grid.types";
export type FeatureShowcaseProps = {
id: string;
title: string;
lead?: string;
features: Feature[];
empty?: string;
more: string;
item?: "picture" | "panel";
cols?: "3" | "4";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Card from "../compose/Card.vue";
import CardContent from "../compose/CardContent.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import EmptyState from "../components/empty-state.vue";
import MediaFrame from "../components/media-frame.vue";
import MenuEntry from "../components/menu-entry.vue";
import SectionFrame from "../components/section-frame.vue";
const {
id,
title,
lead = "",
features,
empty = "",
more,
item = "picture",
cols = "3",
tone = "default",
landmarkLabel,
} = defineProps<FeatureShowcaseProps>();
</script>
<template>
<SectionFrame :id="id" :title="title" :lead="lead" :tone="tone" align="center" :landmarkLabel="landmarkLabel">
<EmptyState v-if="((features?.length ?? 0) === 0)" icon="layout-grid" :title="empty" />
<Box v-else
:class="
(cols as string) === '4' ? 'grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-4'
: 'grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-3'
"
>
<Card v-for="f in features" :key="f.id" variant="default" class="h-full gap-4 overflow-hidden">
<MediaFrame v-if="((item as string) === 'picture')" :alt="f.title" :src="f.image" />
<Box v-else
class="flex aspect-video items-center justify-center rounded bg-muted text-foreground"
data-slot="showcase-panel"
>
<LucideIcon :name="f.icon" :size="32" />
</Box>
<CardContent class="flex flex-1 flex-col gap-2">
<Title :as="3" size="base" weight="semibold">
{{ f.title }}
</Title>
<Text size="sm" class="text-muted-foreground">
{{ f.text }}
</Text>
<MenuEntry
v-if="((item as string) === 'picture')"
:href="f.href"
class="mt-auto gap-2 pt-2 text-sm font-medium"
size="sm"
testid="read"
>
{{ more }}
<LucideIcon name="arrow-right" :size="16" />
</MenuEntry>
</CardContent>
</Card>
</Box>
</SectionFrame>
</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 feature-showcase// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Features as cards under a centered heading. Axes: item (picture: a picture on top, then the title, the text
* and a read link; panel: a muted panel with a large glyph on top, then the title and the text), cols (3, 4),
* tone.
*/
import { For, type JSX } from "solid-js";
import { Box, Card, CardContent, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { MenuEntry } from "../components/menu-entry";
import { SectionFrame } from "../components/section-frame";
import type { Feature } from "./feature-grid.types";
export type FeatureShowcaseProps = {
id: string;
title: string;
lead?: string;
features: Feature[];
empty?: string;
more: string;
item?: "picture" | "panel";
cols?: "3" | "4";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function FeatureShowcase({
id,
title,
lead = "",
features,
empty = "",
more,
item = "picture",
cols = "3",
tone = "default",
landmarkLabel,
}: FeatureShowcaseProps) {
return (
<SectionFrame id={id} title={title} lead={lead} tone={tone} align="center" landmarkLabel={landmarkLabel}>
{((features?.length ?? 0) === 0) ? (
<EmptyState icon="layout-grid" title={empty} />
) : (
<Box
class={
(cols as string) === "4" ? "grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-4"
: "grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-3"
}
>
<For each={features ?? []}>{(f) => (
<Card variant="default" class="h-full gap-4 overflow-hidden">
{((item as string) === "picture") ? (
<MediaFrame alt={f.title} src={f.image} />
) : (
<Box
class="flex aspect-video items-center justify-center rounded bg-muted text-foreground"
data-slot="showcase-panel"
>
<LucideIcon name={f.icon} size={32} />
</Box>
)}
<CardContent class="flex flex-1 flex-col gap-2">
<Title as={3} size="base" weight="semibold">
{f.title}
</Title>
<Text size="sm" class="text-muted-foreground">
{f.text}
</Text>
{((item as string) === "picture") ? (
<MenuEntry href={f.href} class="mt-auto gap-2 pt-2 text-sm font-medium" size="sm" testid="read">
{more}
<LucideIcon name="arrow-right" size={16} />
</MenuEntry>
) : null}
</CardContent>
</Card>
)}</For>
</Box>
)}
</SectionFrame>
);
}
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 feature-showcase// 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/feature-showcase.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"
)
// FeatureShowcaseProps are the props of FeatureShowcase; the values are the JSON shapes of the TypeScript props.
type FeatureShowcaseProps struct {
Id any `json:"id"`
Title any `json:"title"`
Lead any `json:"lead"`
Features any `json:"features"`
Empty any `json:"empty"`
More any `json:"more"`
Item any `json:"item"`
Cols any `json:"cols"`
Tone any `json:"tone"`
LandmarkLabel any `json:"landmarkLabel"`
}
// Features as cards under a centered heading. Axes: item (picture: a picture on top, then the title, the text and a read link; panel: a muted panel with a large glyph on top, then the title and the text), cols (3, 4), tone.
templ FeatureShowcase(p FeatureShowcaseProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vLead := uiutils.Def(p.Lead, "") }}
{{ vFeatures := p.Features }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vMore := p.More }}
{{ vItem := uiutils.Def(p.Item, "picture") }}
{{ vCols := uiutils.Def(p.Cols, "3") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vLead, Tone: vTone, Align: "center", LandmarkLabel: vLandmarkLabel}) {
if uiutils.Eq(uiutils.Len(vFeatures), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "layout-grid", Title: vEmpty})
} else {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "4")), "grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-4", "grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-3"))}}) {
for _, vF := range uiutils.L(vFeatures) {
@compose.Card(compose.CardProps{Variant: "default", BoxProps: box.BoxProps{Class: "h-full gap-4 overflow-hidden"}}) {
if uiutils.Eq(vItem, "picture") {
@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vF, "title"), Src: uiutils.Get(vF, "image")})
} else {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "flex aspect-video items-center justify-center rounded bg-muted text-foreground", Attrs: uiutils.Attrs("data-slot", "showcase-panel")}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vF, "icon")), Size: 32})
}
}
@compose.CardContent(compose.CardContentProps{BoxProps: box.BoxProps{Class: "flex flex-1 flex-col gap-2"}}) {
@compose.Title(compose.TitleProps{As: "3", Size: "base", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vF, "title")) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vF, "text")) }
}
if uiutils.Eq(vItem, "picture") {
@MenuEntry(MenuEntryProps{Href: uiutils.Get(vF, "href"), Class: uiutils.Cnv("mt-auto gap-2 pt-2 text-sm font-medium"), Size: "sm", Testid: "read"}) {
{ uiutils.Text(vMore) }
@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 feature-showcase{#- 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/feature-showcase.json
Features as cards under a centered heading. Axes: item (picture: a picture on top, then the title, the text and a read link; panel: a muted panel with a large glyph on top, then the title and the text), cols (3, 4), tone.
Props (p): id, title, lead, features, empty, more, item, cols, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_lead = (p.lead ?? '') -%}
{%- set v_features = (p.features ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_more = (p.more ?? null) -%}
{%- set v_item = (p.item ?? 'picture') -%}
{%- set v_cols = (p.cols ?? '3') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_8 -%}
{%- if og_t(og_eq(og_len(v_features), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'layout-grid', 'title': v_empty}}, with_context = false) }}
{%- else %}
{%- set c_7 -%}
{%- for v_f in og_l(v_features) %}
{%- set c_6 -%}
{%- if og_t(og_eq(v_item, 'picture')) %}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_f, ['title']), 'src': og_get(v_f, ['image'])}}, with_context = false) }}
{%- else %}
{%- set c_1 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_f, ['icon'])), 'size': 32}, with_context = false) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'flex aspect-video items-center justify-center rounded bg-muted text-foreground', 'attrs': og_attrs(['data-slot', 'showcase-panel']), 'children': c_1}, with_context = false) }}
{%- endif %}
{%- set c_5 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'base', 'weight': 'semibold', 'children': c_2}, with_context = false) }}
{%- set c_3 -%}
{{ og_text(og_get(v_f, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
{%- if og_t(og_eq(v_item, 'picture')) %}
{%- set c_4 -%}
{{ og_text(v_more) }}
{{ 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_f, ['href']), 'className': og_cnv(['mt-auto gap-2 pt-2 text-sm font-medium']), 'size': 'sm', 'testid': 'read'}, 'children': og_markup(c_4)}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/CardContent.html.twig', {'class': 'flex flex-1 flex-col gap-2', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/Card.html.twig', {'variant': 'default', 'class': 'h-full gap-4 overflow-hidden', 'children': c_6}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s((og_t(og_eq(v_cols, '4')) ? 'grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-4' : 'grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-3')), 'children': c_7}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'align': 'center', 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(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 feature-showcase{* 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/feature-showcase.json
Features as cards under a centered heading. Axes: item (picture: a picture on top, then the title, the text and a read link; panel: a muted panel with a large glyph on top, then the title and the text), cols (3, 4), tone.
Props (p): id, title, lead, features, empty, more, item, cols, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_lead = ($p['lead'] ?? '')}
{var $v_features = ($p['features'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_more = ($p['more'] ?? null)}
{var $v_item = ($p['item'] ?? 'picture')}
{var $v_cols = ($p['cols'] ?? '3')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_8}
{if og_t(og_eq(og_len($v_features), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'layout-grid', 'title' => $v_empty]])|noescape}
{else}
{capture $c_7}
{foreach og_l($v_features) as $v_f}
{capture $c_6}
{if og_t(og_eq($v_item, 'picture'))}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_f, ['title']), 'src' => og_get($v_f, ['image'])]])|noescape}
{else}
{capture $c_1}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_f, ['icon'])), 'size' => 32])|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'flex aspect-video items-center justify-center rounded bg-muted text-foreground', 'attrs' => og_attrs(['data-slot', 'showcase-panel']), 'children' => (string) $c_1])|noescape}
{/if}
{capture $c_5}
{capture $c_2}
{=og_text(og_get($v_f, ['title']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'base', 'weight' => 'semibold', 'children' => (string) $c_2])|noescape}
{capture $c_3}
{=og_text(og_get($v_f, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
{if og_t(og_eq($v_item, 'picture'))}
{capture $c_4}
{=og_text($v_more)}
{=og_include('icons/LucideIcon.latte', ['name' => 'arrow-right', 'size' => 16])|noescape}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_f, ['href']), 'className' => og_cnv(['mt-auto gap-2 pt-2 text-sm font-medium']), 'size' => 'sm', 'testid' => 'read'], 'children' => og_markup($c_4)])|noescape}
{/if}
{/capture}
{=og_include('compose/CardContent.latte', ['class' => 'flex flex-1 flex-col gap-2', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/Card.latte', ['variant' => 'default', 'class' => 'h-full gap-4 overflow-hidden', 'children' => (string) $c_6])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s((og_t(og_eq($v_cols, '4')) ? 'grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-4' : 'grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-3')), 'children' => (string) $c_7])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_lead, 'tone' => $v_tone, 'align' => 'center', 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($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 feature-showcase{#- 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/feature-showcase.json
Features as cards under a centered heading. Axes: item (picture: a picture on top, then the title, the text and a read link; panel: a muted panel with a large glyph on top, then the title and the text), cols (3, 4), tone.
Props (p): id, title, lead, features, empty, more, item, cols, tone, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_lead = og_def(p['lead'], '') -%}
{%- set v_features = og_def(p['features'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_more = og_def(p['more'], none) -%}
{%- set v_item = og_def(p['item'], 'picture') -%}
{%- set v_cols = og_def(p['cols'], '3') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_8 -%}
{%- if og_t(og_eq(og_len(v_features), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'layout-grid', 'title': v_empty}}) }}
{%- else %}
{%- set c_7 -%}
{%- for v_f in og_l(v_features) %}
{%- set c_6 -%}
{%- if og_t(og_eq(v_item, 'picture')) %}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_f, ['title']), 'src': og_get(v_f, ['image'])}}) }}
{%- else %}
{%- set c_1 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_f, ['icon'])), 'Size': 32}}) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'flex aspect-video items-center justify-center rounded bg-muted text-foreground', 'Attrs': og_attrs(['data-slot', 'showcase-panel'])}, 'children': c_1}) }}
{%- endif %}
{%- set c_5 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'base', 'Weight': 'semibold'}, 'children': c_2}) }}
{%- set c_3 -%}
{{ og_text(og_get(v_f, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
{%- if og_t(og_eq(v_item, 'picture')) %}
{%- set c_4 -%}
{{ og_text(v_more) }}
{{ 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_f, ['href']), 'className': og_cnv(['mt-auto gap-2 pt-2 text-sm font-medium']), 'size': 'sm', 'testid': 'read'}, 'children': og_markup(c_4)}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/card-content.html.j2', {'p': {'Class': 'flex flex-1 flex-col gap-2'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/card.html.j2', {'p': {'Variant': 'default', 'Class': 'h-full gap-4 overflow-hidden'}, 'children': c_6}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(('grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-4' if og_t(og_eq(v_cols, '4')) else 'grid grid-cols-1 gap-6 text-start sm:grid-cols-2 lg:grid-cols-3'))}, 'children': c_7}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'align': 'center', 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(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.
Features as cards under a centered heading. Axes: item (picture: a picture on top, then the title, the text and a read link; panel: a muted panel with a large glyph on top, then the title and the text), cols (3, 4), tone.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| lead | string | "" | |
| features (required) | Feature[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| more (required) | string | - | the word of the read link of the picture cards |
| item | "picture" | "panel" | "picture" | |
| cols | "3" | "4" | "3" | |
| tone | "default" | "muted" | "default" | |
| landmarkLabel | string | - | accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one |