Feature Metric Cards
Feature Metric Cards component
Install
npx ui8kit add feature-metric-cardsPulls in: box, compose, group, inline, kit-box, kit-text, lucide-icon, stack, stats-band, text, utils
Preview
12,400
Sites published
since launch
99.99%
Uptime
last 12 months
3,200
Teams
in 60 countries
0.8s
Median load
on a mobile network
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-metric-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. -->
<!--
Four figures of FeatureSplit as small cards in two columns: a glyph tile, the value with its hint and the
label.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Stat } from "../blocks/stats-band.types";
export type FeatureMetricCardsProps = {
stats: Stat[];
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Group from "../compose/Group.svelte";
import Inline from "../compose/Inline.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
let { stats }: FeatureMetricCardsProps = $props();
</script>
<Box class="grid grid-cols-1 gap-4 sm:grid-cols-2" data-slot="feature-metric-cards">
{#each stats as s, i (s.id)}
{#if (i < 4)}
<Group gap="4" align="center" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="feature-stat">
<Inline class="flex size-10 shrink-0 items-center justify-center rounded bg-muted text-foreground">
<LucideIcon name={s.icon} size={20} />
</Inline>
<Stack gap="0" class="min-w-0">
<Text size="lg" weight="bold">
{s.value}
</Text>
<Text size="xs" class="text-muted-foreground">
{s.label}
</Text>
<Text size="xs" class="text-muted-foreground">
{s.hint}
</Text>
</Stack>
</Group>
{/if}
{/each}
</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 feature-metric-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.
/**
* Four figures of FeatureSplit as small cards in two columns: a glyph tile, the value with its hint and the
* label.
*/
import { Fragment, type ReactNode } from "react";
import { Box, Group, Inline, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import type { Stat } from "../blocks/stats-band.types";
export type FeatureMetricCardsProps = {
stats: Stat[];
};
export function FeatureMetricCards({ stats }: FeatureMetricCardsProps) {
return (
<Box className="grid grid-cols-1 gap-4 sm:grid-cols-2" data-slot="feature-metric-cards">
{(stats ?? []).map((s, i) => (
<Fragment key={s.id}>
{(i < 4) ? (
<Group
gap="4"
align="center"
className="rounded bg-card inset-ring inset-ring-border p-4"
data-slot="feature-stat"
>
<Inline className="flex size-10 shrink-0 items-center justify-center rounded bg-muted text-foreground">
<LucideIcon name={s.icon} size={20} />
</Inline>
<Stack gap="0" className="min-w-0">
<Text size="lg" weight="bold">
{s.value}
</Text>
<Text size="xs" className="text-muted-foreground">
{s.label}
</Text>
<Text size="xs" className="text-muted-foreground">
{s.hint}
</Text>
</Stack>
</Group>
) : null}
</Fragment>
))}
</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 feature-metric-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. -->
<!--
Four figures of FeatureSplit as small cards in two columns: a glyph tile, the value with its hint and the
label.
-->
<script lang="ts">
import type { Stat } from "../blocks/stats-band.types";
export type FeatureMetricCardsProps = {
stats: Stat[];
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
const { stats } = defineProps<FeatureMetricCardsProps>();
</script>
<template>
<Box class="grid grid-cols-1 gap-4 sm:grid-cols-2" data-slot="feature-metric-cards">
<template v-for="(s, i) in stats" :key="s.id">
<Group
v-if="(i < 4)"
gap="4"
align="center"
class="rounded bg-card inset-ring inset-ring-border p-4"
data-slot="feature-stat"
>
<Inline class="flex size-10 shrink-0 items-center justify-center rounded bg-muted text-foreground">
<LucideIcon :name="s.icon" :size="20" />
</Inline>
<Stack gap="0" class="min-w-0">
<Text size="lg" weight="bold">
{{ s.value }}
</Text>
<Text size="xs" class="text-muted-foreground">
{{ s.label }}
</Text>
<Text size="xs" class="text-muted-foreground">
{{ s.hint }}
</Text>
</Stack>
</Group>
</template>
</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 feature-metric-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.
/**
* Four figures of FeatureSplit as small cards in two columns: a glyph tile, the value with its hint and the
* label.
*/
import { For, type JSX } from "solid-js";
import { Box, Group, Inline, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import type { Stat } from "../blocks/stats-band.types";
export type FeatureMetricCardsProps = {
stats: Stat[];
};
export function FeatureMetricCards({ stats }: FeatureMetricCardsProps) {
return (
<Box class="grid grid-cols-1 gap-4 sm:grid-cols-2" data-slot="feature-metric-cards">
<For each={stats ?? []}>{(s, iOf) => { const i = iOf(); return (
<>
{(i < 4) ? (
<Group gap="4" align="center" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="feature-stat">
<Inline class="flex size-10 shrink-0 items-center justify-center rounded bg-muted text-foreground">
<LucideIcon name={s.icon} size={20} />
</Inline>
<Stack gap="0" class="min-w-0">
<Text size="lg" weight="bold">
{s.value}
</Text>
<Text size="xs" class="text-muted-foreground">
{s.label}
</Text>
<Text size="xs" class="text-muted-foreground">
{s.hint}
</Text>
</Stack>
</Group>
) : null}
</>
); }}</For>
</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 feature-metric-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-metric-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"
)
// FeatureMetricCardsProps are the props of FeatureMetricCards; the values are the JSON shapes of the TypeScript props.
type FeatureMetricCardsProps struct {
Stats any `json:"stats"`
}
// Four figures of FeatureSplit as small cards in two columns: a glyph tile, the value with its hint and the label.
templ FeatureMetricCards(p FeatureMetricCardsProps) {
{{ vStats := p.Stats }}
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "grid grid-cols-1 gap-4 sm:grid-cols-2", Attrs: uiutils.Attrs("data-slot", "feature-metric-cards")}}) {
for vI, vS := range uiutils.L(vStats) {
if uiutils.Lt(float64(vI), float64(4)) {
@compose.Group(compose.GroupProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-4", Attrs: uiutils.Attrs("data-slot", "feature-stat")}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex size-10 shrink-0 items-center justify-center rounded bg-muted text-foreground"}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vS, "icon")), Size: 20})
}
@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{Class: "min-w-0"}}) {
@compose.Text(compose.TextProps{Size: "lg", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vS, "value")) }
}
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vS, "label")) }
}
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vS, "hint")) }
}
}
}
}
}
}
}
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-metric-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-metric-cards.json
Four figures of FeatureSplit as small cards in two columns: a glyph tile, the value with its hint and the label.
Props (p): stats. -#}
{%- set v_stats = (p.stats ?? null) -%}
{%- set c_7 -%}
{%- for v_s in og_l(v_stats) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_lt(v_i, 4)) %}
{%- set c_6 -%}
{%- set c_1 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_s, ['icon'])), 'size': 20}, with_context = false) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'flex size-10 shrink-0 items-center justify-center rounded bg-muted text-foreground', 'children': c_1}, with_context = false) }}
{%- set c_5 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_s, ['value'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'lg', 'weight': 'bold', 'children': c_2}, with_context = false) }}
{%- set c_3 -%}
{{ og_text(og_get(v_s, ['label'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
{%- set c_4 -%}
{{ og_text(og_get(v_s, ['hint'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '0', 'class': 'min-w-0', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'class': 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs': og_attrs(['data-slot', 'feature-stat']), 'children': c_6}, with_context = false) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'grid grid-cols-1 gap-4 sm:grid-cols-2', 'attrs': og_attrs(['data-slot', 'feature-metric-cards']), 'children': c_7}, 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-metric-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-metric-cards.json
Four figures of FeatureSplit as small cards in two columns: a glyph tile, the value with its hint and the label.
Props (p): stats. *}
{var $v_stats = ($p['stats'] ?? null)}
{capture $c_7}
{foreach og_l($v_stats) as $v_s}
{var $v_i = $iterator->counter0}
{if og_t(og_lt($v_i, 4))}
{capture $c_6}
{capture $c_1}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_s, ['icon'])), 'size' => 20])|noescape}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'flex size-10 shrink-0 items-center justify-center rounded bg-muted text-foreground', 'children' => (string) $c_1])|noescape}
{capture $c_5}
{capture $c_2}
{=og_text(og_get($v_s, ['value']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'lg', 'weight' => 'bold', 'children' => (string) $c_2])|noescape}
{capture $c_3}
{=og_text(og_get($v_s, ['label']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
{capture $c_4}
{=og_text(og_get($v_s, ['hint']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '0', 'class' => 'min-w-0', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'class' => 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs' => og_attrs(['data-slot', 'feature-stat']), 'children' => (string) $c_6])|noescape}
{/if}
{/foreach}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'grid grid-cols-1 gap-4 sm:grid-cols-2', 'attrs' => og_attrs(['data-slot', 'feature-metric-cards']), 'children' => (string) $c_7])|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-metric-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-metric-cards.json
Four figures of FeatureSplit as small cards in two columns: a glyph tile, the value with its hint and the label.
Props (p): stats. -#}
{%- set v_stats = og_def(p['stats'], none) -%}
{%- set c_7 -%}
{%- for v_s in og_l(v_stats) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_lt(v_i, 4)) %}
{%- set c_6 -%}
{%- set c_1 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_s, ['icon'])), 'Size': 20}}) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex size-10 shrink-0 items-center justify-center rounded bg-muted text-foreground'}, 'children': c_1}) }}
{%- set c_5 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_s, ['value'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'lg', 'Weight': 'bold'}, 'children': c_2}) }}
{%- set c_3 -%}
{{ og_text(og_get(v_s, ['label'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
{%- set c_4 -%}
{{ og_text(og_get(v_s, ['hint'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '0', 'Class': 'min-w-0'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Class': 'rounded bg-card inset-ring inset-ring-border p-4', 'Attrs': og_attrs(['data-slot', 'feature-stat'])}, 'children': c_6}) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'grid grid-cols-1 gap-4 sm:grid-cols-2', 'Attrs': og_attrs(['data-slot', 'feature-metric-cards'])}, 'children': c_7}) }}
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.
Four figures of FeatureSplit as small cards in two columns: a glyph tile, the value with its hint and the label.
| Prop | Type | Default | Description |
|---|---|---|---|
| stats (required) | Stat[] | - |