Feature Cards
Feature Cards component
Install
npx ui8kit add feature-cardsPulls in: card, card-content, card-header, card-title, compose, feature-grid, grid, group, icon-badge, kit-box, kit-text, lucide-icon, presets, stack, text, title, utils
Preview
Fast by default
Pages render from static data and ship little script.
Clear structure
One heading per page, landmarks and a skip link come built in.
Safe forms
Inputs carry labels and errors are announced to assistive tools.
Ready for any language
Every text lives in a dictionary, so a new language is one more file.
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-cdnnpx ui8kit add feature-cards<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!-- The features as a grid of cards, tiles or bordered cells (the body of FeatureGrid). Icons are Lucide names. -->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Feature } from "../blocks/feature-grid.types";
export type FeatureCardsProps = {
features: Feature[];
cols?: "1-2" | "1-3" | "1-4";
item?: "card" | "tile" | "cell";
};
</script>
<script lang="ts">
import Card from "../compose/Card.svelte";
import CardContent from "../compose/CardContent.svelte";
import CardHeader from "../compose/CardHeader.svelte";
import CardTitle from "../compose/CardTitle.svelte";
import Grid from "../compose/Grid.svelte";
import Group from "../compose/Group.svelte";
import IconBadge from "../compose/IconBadge.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 { defaults } from "../presets/defaults";
import { cn } from "../utils";
let { features, cols = "1-3", item = "card" }: FeatureCardsProps = $props();
</script>
<Grid
cols={cols}
class={
(item as string) === "cell" ? cn("w-full gap-px overflow-hidden bg-border p-px", defaults.features.cells)
: "gap-6"
}
data-slot="feature-grid"
>
{#each features as feature (feature.id)}
{#if ((item as string) === "tile")}
<Card variant="compact">
<Group gap="4" align="start">
<LucideIcon name={feature.icon} size={20} />
<Stack gap="2">
<Title as={3} size="base" weight="bold">
{feature.title}
</Title>
<Text size="sm" class="text-muted-foreground">
{feature.text}
</Text>
</Stack>
</Group>
</Card>
{:else if ((item as string) === "cell")}
<Stack
gap="2"
align="center"
class="h-full gap-8 bg-background px-6 py-12 text-center"
data-slot="feature-card"
>
<IconBadge variant="primary" size="xl" data-slot="feature-icon">
<LucideIcon name={feature.icon} size={24} />
</IconBadge>
<Title as={3} size="xl" weight="semibold" class="leading-6">
{feature.title}
</Title>
<Text size="sm" weight="semibold" class="leading-5 text-muted-foreground">
{feature.text}
</Text>
</Stack>
{:else}
<Card variant="default">
<CardHeader class="flex flex-col gap-4">
<LucideIcon name={feature.icon} size={24} />
<CardTitle as={3}>
{feature.title}
</CardTitle>
</CardHeader>
<CardContent>
<Text size="sm" class="text-muted-foreground">
{feature.text}
</Text>
</CardContent>
</Card>
{/if}
{/each}
</Grid>
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-cards// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/** The features as a grid of cards, tiles or bordered cells (the body of FeatureGrid). Icons are Lucide names. */
import { Fragment, type ReactNode } from "react";
import { Card, CardContent, CardHeader, CardTitle, Grid, Group, IconBadge, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { defaults } from "../presets/defaults";
import { cn } from "../utils";
import type { Feature } from "../blocks/feature-grid.types";
export type FeatureCardsProps = {
features: Feature[];
cols?: "1-2" | "1-3" | "1-4";
item?: "card" | "tile" | "cell";
};
export function FeatureCards({ features, cols = "1-3", item = "card" }: FeatureCardsProps) {
return (
<Grid
cols={cols}
className={
(item as string) === "cell" ? cn("w-full gap-px overflow-hidden bg-border p-px", defaults.features.cells)
: "gap-6"
}
data-slot="feature-grid"
>
{(features ?? []).map((feature) => (
<Fragment key={feature.id}>
{((item as string) === "tile") ? (
<Card variant="compact">
<Group gap="4" align="start">
<LucideIcon name={feature.icon} size={20} />
<Stack gap="2">
<Title as={3} size="base" weight="bold">
{feature.title}
</Title>
<Text size="sm" className="text-muted-foreground">
{feature.text}
</Text>
</Stack>
</Group>
</Card>
) : ((item as string) === "cell") ? (
<Stack
gap="2"
align="center"
className="h-full gap-8 bg-background px-6 py-12 text-center"
data-slot="feature-card"
>
<IconBadge variant="primary" size="xl" data-slot="feature-icon">
<LucideIcon name={feature.icon} size={24} />
</IconBadge>
<Title as={3} size="xl" weight="semibold" className="leading-6">
{feature.title}
</Title>
<Text size="sm" weight="semibold" className="leading-5 text-muted-foreground">
{feature.text}
</Text>
</Stack>
) : (
<Card variant="default">
<CardHeader className="flex flex-col gap-4">
<LucideIcon name={feature.icon} size={24} />
<CardTitle as={3}>
{feature.title}
</CardTitle>
</CardHeader>
<CardContent>
<Text size="sm" className="text-muted-foreground">
{feature.text}
</Text>
</CardContent>
</Card>
)}
</Fragment>
))}
</Grid>
);
}
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-cards<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!-- The features as a grid of cards, tiles or bordered cells (the body of FeatureGrid). Icons are Lucide names. -->
<script lang="ts">
import type { Feature } from "../blocks/feature-grid.types";
export type FeatureCardsProps = {
features: Feature[];
cols?: "1-2" | "1-3" | "1-4";
item?: "card" | "tile" | "cell";
};
</script>
<script setup lang="ts">
import Card from "../compose/Card.vue";
import CardContent from "../compose/CardContent.vue";
import CardHeader from "../compose/CardHeader.vue";
import CardTitle from "../compose/CardTitle.vue";
import Grid from "../compose/Grid.vue";
import Group from "../compose/Group.vue";
import IconBadge from "../compose/IconBadge.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 { defaults } from "../presets/defaults";
import { cn } from "../utils";
const { features, cols = "1-3", item = "card" } = defineProps<FeatureCardsProps>();
</script>
<template>
<Grid
:cols="cols"
:class="
(item as string) === 'cell' ? cn('w-full gap-px overflow-hidden bg-border p-px', defaults.features.cells)
: 'gap-6'
"
data-slot="feature-grid"
>
<template v-for="feature in features" :key="feature.id">
<Card v-if="((item as string) === 'tile')" variant="compact">
<Group gap="4" align="start">
<LucideIcon :name="feature.icon" :size="20" />
<Stack gap="2">
<Title :as="3" size="base" weight="bold">
{{ feature.title }}
</Title>
<Text size="sm" class="text-muted-foreground">
{{ feature.text }}
</Text>
</Stack>
</Group>
</Card>
<Stack v-else-if="((item as string) === 'cell')"
gap="2"
align="center"
class="h-full gap-8 bg-background px-6 py-12 text-center"
data-slot="feature-card"
>
<IconBadge variant="primary" size="xl" data-slot="feature-icon">
<LucideIcon :name="feature.icon" :size="24" />
</IconBadge>
<Title :as="3" size="xl" weight="semibold" class="leading-6">
{{ feature.title }}
</Title>
<Text size="sm" weight="semibold" class="leading-5 text-muted-foreground">
{{ feature.text }}
</Text>
</Stack>
<Card v-else variant="default">
<CardHeader class="flex flex-col gap-4">
<LucideIcon :name="feature.icon" :size="24" />
<CardTitle :as="3">
{{ feature.title }}
</CardTitle>
</CardHeader>
<CardContent>
<Text size="sm" class="text-muted-foreground">
{{ feature.text }}
</Text>
</CardContent>
</Card>
</template>
</Grid>
</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-cards// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/** The features as a grid of cards, tiles or bordered cells (the body of FeatureGrid). Icons are Lucide names. */
import { For, type JSX } from "solid-js";
import { Card, CardContent, CardHeader, CardTitle, Grid, Group, IconBadge, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { defaults } from "../presets/defaults";
import { cn } from "../utils";
import type { Feature } from "../blocks/feature-grid.types";
export type FeatureCardsProps = {
features: Feature[];
cols?: "1-2" | "1-3" | "1-4";
item?: "card" | "tile" | "cell";
};
export function FeatureCards({ features, cols = "1-3", item = "card" }: FeatureCardsProps) {
return (
<Grid
cols={cols}
class={
(item as string) === "cell" ? cn("w-full gap-px overflow-hidden bg-border p-px", defaults.features.cells)
: "gap-6"
}
data-slot="feature-grid"
>
<For each={features ?? []}>{(feature) => (
<>
{((item as string) === "tile") ? (
<Card variant="compact">
<Group gap="4" align="start">
<LucideIcon name={feature.icon} size={20} />
<Stack gap="2">
<Title as={3} size="base" weight="bold">
{feature.title}
</Title>
<Text size="sm" class="text-muted-foreground">
{feature.text}
</Text>
</Stack>
</Group>
</Card>
) : ((item as string) === "cell") ? (
<Stack
gap="2"
align="center"
class="h-full gap-8 bg-background px-6 py-12 text-center"
data-slot="feature-card"
>
<IconBadge variant="primary" size="xl" data-slot="feature-icon">
<LucideIcon name={feature.icon} size={24} />
</IconBadge>
<Title as={3} size="xl" weight="semibold" class="leading-6">
{feature.title}
</Title>
<Text size="sm" weight="semibold" class="leading-5 text-muted-foreground">
{feature.text}
</Text>
</Stack>
) : (
<Card variant="default">
<CardHeader class="flex flex-col gap-4">
<LucideIcon name={feature.icon} size={24} />
<CardTitle as={3}>
{feature.title}
</CardTitle>
</CardHeader>
<CardContent>
<Text size="sm" class="text-muted-foreground">
{feature.text}
</Text>
</CardContent>
</Card>
)}
</>
)}</For>
</Grid>
);
}
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-cards// 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-cards.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"
)
// FeatureCardsProps are the props of FeatureCards; the values are the JSON shapes of the TypeScript props.
type FeatureCardsProps struct {
Features any `json:"features"`
Cols any `json:"cols"`
Item any `json:"item"`
}
// The features as a grid of cards, tiles or bordered cells (the body of FeatureGrid). Icons are Lucide names.
templ FeatureCards(p FeatureCardsProps) {
{{ vFeatures := p.Features }}
{{ vCols := uiutils.Def(p.Cols, "1-3") }}
{{ vItem := uiutils.Def(p.Item, "card") }}
@compose.Grid(compose.GridProps{Cols: uiutils.S(vCols), BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vItem, "cell")), uiutils.Cnv("w-full gap-px overflow-hidden bg-border p-px", uiutils.Get(presetDefaults, "features", "cells")), "gap-6")), Attrs: uiutils.Attrs("data-slot", "feature-grid")}}) {
for _, vFeature := range uiutils.L(vFeatures) {
if uiutils.Eq(vItem, "tile") {
@compose.Card(compose.CardProps{Variant: "compact", BoxProps: box.BoxProps{}}) {
@compose.Group(compose.GroupProps{Gap: "4", Align: "start", BoxProps: box.BoxProps{}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vFeature, "icon")), Size: 20})
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{}}) {
@compose.Title(compose.TitleProps{As: "3", Size: "base", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vFeature, "title")) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vFeature, "text")) }
}
}
}
}
} else if uiutils.Eq(vItem, "cell") {
@compose.Stack(compose.StackProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{Class: "h-full gap-8 bg-background px-6 py-12 text-center", Attrs: uiutils.Attrs("data-slot", "feature-card")}}) {
@compose.IconBadge(compose.IconBadgeProps{Variant: "primary", Size: "xl", TextProps: text.TextProps{Attrs: uiutils.Attrs("data-slot", "feature-icon")}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vFeature, "icon")), Size: 24})
}
@compose.Title(compose.TitleProps{As: "3", Size: "xl", Weight: "semibold", TextProps: text.TextProps{Class: "leading-6"}}) {
{ uiutils.Text(uiutils.Get(vFeature, "title")) }
}
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{Class: "leading-5 text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vFeature, "text")) }
}
}
} else {
@compose.Card(compose.CardProps{Variant: "default", BoxProps: box.BoxProps{}}) {
@compose.CardHeader(compose.CardHeaderProps{BoxProps: box.BoxProps{Class: "flex flex-col gap-4"}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vFeature, "icon")), Size: 24})
@compose.CardTitle(compose.CardTitleProps{As: "3", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vFeature, "title")) }
}
}
@compose.CardContent(compose.CardContentProps{BoxProps: box.BoxProps{}}) {
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vFeature, "text")) }
}
}
}
}
}
}
}
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-cards{#- 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-cards.json
The features as a grid of cards, tiles or bordered cells (the body of FeatureGrid). Icons are Lucide names.
Props (p): features, cols, item. -#}
{%- set v_features = (p.features ?? null) -%}
{%- set v_cols = (p.cols ?? '1-3') -%}
{%- set v_item = (p.item ?? 'card') -%}
{%- set c_15 -%}
{%- for v_feature in og_l(v_features) %}
{%- if og_t(og_eq(v_item, 'tile')) %}
{%- set c_5 -%}
{%- set c_4 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_feature, ['icon'])), 'size': 20}, with_context = false) }}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_feature, ['title'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'base', 'weight': 'bold', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_get(v_feature, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'children': c_3}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'start', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('compose/Card.html.twig', {'variant': 'compact', 'children': c_5}, with_context = false) }}
{%- elseif og_t(og_eq(v_item, 'cell')) %}
{%- set c_9 -%}
{%- set c_6 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_feature, ['icon'])), 'size': 24}, with_context = false) }}
{%- endset -%}
{{ include('compose/IconBadge.html.twig', {'variant': 'primary', 'size': 'xl', 'attrs': og_attrs(['data-slot', 'feature-icon']), 'children': c_6}, with_context = false) }}
{%- set c_7 -%}
{{ og_text(og_get(v_feature, ['title'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'xl', 'weight': 'semibold', 'class': 'leading-6', 'children': c_7}, with_context = false) }}
{%- set c_8 -%}
{{ og_text(og_get(v_feature, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'class': 'leading-5 text-muted-foreground', 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'align': 'center', 'class': 'h-full gap-8 bg-background px-6 py-12 text-center', 'attrs': og_attrs(['data-slot', 'feature-card']), 'children': c_9}, with_context = false) }}
{%- else %}
{%- set c_14 -%}
{%- set c_11 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_feature, ['icon'])), 'size': 24}, with_context = false) }}
{%- set c_10 -%}
{{ og_text(og_get(v_feature, ['title'])) }}
{%- endset -%}
{{ include('compose/CardTitle.html.twig', {'as': 3, 'children': c_10}, with_context = false) }}
{%- endset -%}
{{ include('compose/CardHeader.html.twig', {'class': 'flex flex-col gap-4', 'children': c_11}, with_context = false) }}
{%- set c_13 -%}
{%- set c_12 -%}
{{ og_text(og_get(v_feature, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_12}, with_context = false) }}
{%- endset -%}
{{ include('compose/CardContent.html.twig', {'children': c_13}, with_context = false) }}
{%- endset -%}
{{ include('compose/Card.html.twig', {'variant': 'default', 'children': c_14}, with_context = false) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': og_s(v_cols), 'class': og_s((og_t(og_eq(v_item, 'cell')) ? og_cnv(['w-full gap-px overflow-hidden bg-border p-px', og_preset('blocks/presets/defaults.json', ['features', 'cells'])]) : 'gap-6')), 'attrs': og_attrs(['data-slot', 'feature-grid']), 'children': c_15}, 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-cards{* 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-cards.json
The features as a grid of cards, tiles or bordered cells (the body of FeatureGrid). Icons are Lucide names.
Props (p): features, cols, item. *}
{var $v_features = ($p['features'] ?? null)}
{var $v_cols = ($p['cols'] ?? '1-3')}
{var $v_item = ($p['item'] ?? 'card')}
{capture $c_15}
{foreach og_l($v_features) as $v_feature}
{if og_t(og_eq($v_item, 'tile'))}
{capture $c_5}
{capture $c_4}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_feature, ['icon'])), 'size' => 20])|noescape}
{capture $c_3}
{capture $c_1}
{=og_text(og_get($v_feature, ['title']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'base', 'weight' => 'bold', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_text(og_get($v_feature, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'children' => (string) $c_3])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'start', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('compose/Card.latte', ['variant' => 'compact', 'children' => (string) $c_5])|noescape}
{elseif og_t(og_eq($v_item, 'cell'))}
{capture $c_9}
{capture $c_6}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_feature, ['icon'])), 'size' => 24])|noescape}
{/capture}
{=og_include('compose/IconBadge.latte', ['variant' => 'primary', 'size' => 'xl', 'attrs' => og_attrs(['data-slot', 'feature-icon']), 'children' => (string) $c_6])|noescape}
{capture $c_7}
{=og_text(og_get($v_feature, ['title']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'xl', 'weight' => 'semibold', 'class' => 'leading-6', 'children' => (string) $c_7])|noescape}
{capture $c_8}
{=og_text(og_get($v_feature, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'class' => 'leading-5 text-muted-foreground', 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'align' => 'center', 'class' => 'h-full gap-8 bg-background px-6 py-12 text-center', 'attrs' => og_attrs(['data-slot', 'feature-card']), 'children' => (string) $c_9])|noescape}
{else}
{capture $c_14}
{capture $c_11}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_feature, ['icon'])), 'size' => 24])|noescape}
{capture $c_10}
{=og_text(og_get($v_feature, ['title']))}
{/capture}
{=og_include('compose/CardTitle.latte', ['as' => 3, 'children' => (string) $c_10])|noescape}
{/capture}
{=og_include('compose/CardHeader.latte', ['class' => 'flex flex-col gap-4', 'children' => (string) $c_11])|noescape}
{capture $c_13}
{capture $c_12}
{=og_text(og_get($v_feature, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_12])|noescape}
{/capture}
{=og_include('compose/CardContent.latte', ['children' => (string) $c_13])|noescape}
{/capture}
{=og_include('compose/Card.latte', ['variant' => 'default', 'children' => (string) $c_14])|noescape}
{/if}
{/foreach}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => og_s($v_cols), 'class' => og_s((og_t(og_eq($v_item, 'cell')) ? og_cnv(['w-full gap-px overflow-hidden bg-border p-px', og_preset('blocks/presets/defaults.json', ['features', 'cells'])]) : 'gap-6')), 'attrs' => og_attrs(['data-slot', 'feature-grid']), 'children' => (string) $c_15])|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-cards{#- 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-cards.json
The features as a grid of cards, tiles or bordered cells (the body of FeatureGrid). Icons are Lucide names.
Props (p): features, cols, item. -#}
{%- set v_features = og_def(p['features'], none) -%}
{%- set v_cols = og_def(p['cols'], '1-3') -%}
{%- set v_item = og_def(p['item'], 'card') -%}
{%- set c_15 -%}
{%- for v_feature in og_l(v_features) %}
{%- if og_t(og_eq(v_item, 'tile')) %}
{%- set c_5 -%}
{%- set c_4 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_feature, ['icon'])), 'Size': 20}}) }}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_feature, ['title'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'base', 'Weight': 'bold'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_text(og_get(v_feature, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2'}, 'children': c_3}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'start'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('compose/card.html.j2', {'p': {'Variant': 'compact'}, 'children': c_5}) }}
{%- elif og_t(og_eq(v_item, 'cell')) %}
{%- set c_9 -%}
{%- set c_6 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_feature, ['icon'])), 'Size': 24}}) }}
{%- endset -%}
{{ og_include('compose/icon-badge.html.j2', {'p': {'Variant': 'primary', 'Size': 'xl', 'Attrs': og_attrs(['data-slot', 'feature-icon'])}, 'children': c_6}) }}
{%- set c_7 -%}
{{ og_text(og_get(v_feature, ['title'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'xl', 'Weight': 'semibold', 'Class': 'leading-6'}, 'children': c_7}) }}
{%- set c_8 -%}
{{ og_text(og_get(v_feature, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold', 'Class': 'leading-5 text-muted-foreground'}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Class': 'h-full gap-8 bg-background px-6 py-12 text-center', 'Attrs': og_attrs(['data-slot', 'feature-card'])}, 'children': c_9}) }}
{%- else %}
{%- set c_14 -%}
{%- set c_11 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_feature, ['icon'])), 'Size': 24}}) }}
{%- set c_10 -%}
{{ og_text(og_get(v_feature, ['title'])) }}
{%- endset -%}
{{ og_include('compose/card-title.html.j2', {'p': {'As': 3}, 'children': c_10}) }}
{%- endset -%}
{{ og_include('compose/card-header.html.j2', {'p': {'Class': 'flex flex-col gap-4'}, 'children': c_11}) }}
{%- set c_13 -%}
{%- set c_12 -%}
{{ og_text(og_get(v_feature, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_12}) }}
{%- endset -%}
{{ og_include('compose/card-content.html.j2', {'p': {}, 'children': c_13}) }}
{%- endset -%}
{{ og_include('compose/card.html.j2', {'p': {'Variant': 'default'}, 'children': c_14}) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(v_cols), 'Class': og_s((og_cnv(['w-full gap-px overflow-hidden bg-border p-px', og_preset('blocks/presets/defaults.json', ['features', 'cells'])]) if og_t(og_eq(v_item, 'cell')) else 'gap-6')), 'Attrs': og_attrs(['data-slot', 'feature-grid'])}, 'children': c_15}) }}
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.
The features as a grid of cards, tiles or bordered cells (the body of FeatureGrid). Icons are Lucide names.
| Prop | Type | Default | Description |
|---|---|---|---|
| features (required) | Feature[] | - | |
| cols | "1-2" | "1-3" | "1-4" | "1-3" | columns of the grid (responsive) |
| item | "card" | "tile" | "cell" | "card" | card: icon, title and text stacked; tile: compact icon beside title and text; cell: bordered cell with a round icon |