Stats Band
Key numbers as figures, cards or figures with icons.
Install
npx ui8kit add stats-bandPulls in: backdrop, compose, empty-state, grid, kit-box, presets, section-frame, stat-figure, utils
Preview
12,400
Sites published
99.99%
Uptime
3,200
Teams
0.8s
Median load
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 stats-band<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Key numbers in a row or grid: plain figures, cards (StatTile) or figures with an icon. Axes: columns (2, 3,
4), item (plain, card, icon), surface (none, image, panel: one rounded card), align, density, tone. Title may
be empty.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Stat } from "./stats-band.types";
export type StatsBandProps = {
id: string;
title?: string;
stats: Stat[];
empty?: string;
cols?: "2" | "3" | "4";
layout?: "row" | "stack";
surface?: "none" | "image" | "panel";
item?: "plain" | "card" | "icon";
align?: "start" | "center";
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Grid from "../compose/Grid.svelte";
import Backdrop from "../components/backdrop.svelte";
import EmptyState from "../components/empty-state.svelte";
import SectionFrame from "../components/section-frame.svelte";
import StatFigure from "../components/stat-figure.svelte";
import { defaults } from "../presets/defaults";
import { cn } from "../utils";
let {
id,
title = "",
stats,
empty = "",
cols = "4",
layout = "row",
surface = "none",
item = "plain",
align = "center",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: StatsBandProps = $props();
</script>
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
align={align}
measure={
(surface as string) === "panel" ? "fill"
: (layout as string) === "stack" ? "xs"
: "default"
}
class={cn(
cn((((surface as string) === "image") ? "bg-transparent" : ""), (((surface as string) === "panel") ? "py-0" : "")),
(
(((surface as string) === "image") ? "image" : "none") === "image" ? "relative isolate overflow-hidden"
: ""
)
)}
landmarkLabel={landmarkLabel}
>
<Backdrop
kind={(((surface as string) === "image") ? "image" : "none")}
alt={(imageAlt ? imageAlt : title)}
image={image}
/>
{#if ((stats?.length ?? 0) === 0)}
<EmptyState icon="chart-column" title={empty} />
{:else if ((surface as string) === "panel")}
<Grid
cols={
(cols as string) === "2" ? "2"
: (cols as string) === "3" ? "2-3"
: (cols as string) === "4" ? "2-4"
: "3-6"
}
class={cn("w-full items-center bg-muted px-6", defaults.stats.panel)}
data-slot="items"
>
{#each stats as stat (stat.id)}
<StatFigure stat={stat} item={item} align={align} />
{/each}
</Grid>
{:else}
<Grid
cols={
(layout as string) === "stack" ? "1"
: (cols as string) === "2" ? "2"
: (cols as string) === "3" ? "2-3"
: (cols as string) === "4" ? "2-4"
: "3-6"
}
class="gap-6"
data-slot="items"
>
{#each stats as stat (stat.id)}
<StatFigure stat={stat} item={item} align={align} />
{/each}
</Grid>
{/if}
</SectionFrame>
// 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 Stat = {
id: string;
label: string;
value: string;
icon: string;
hint: string;
};
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 stats-band// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Key numbers in a row or grid: plain figures, cards (StatTile) or figures with an icon. Axes: columns (2, 3,
* 4), item (plain, card, icon), surface (none, image, panel: one rounded card), align, density, tone. Title may
* be empty.
*/
import { type ReactNode } from "react";
import { Grid } from "../compose";
import { Backdrop } from "../components/backdrop";
import { EmptyState } from "../components/empty-state";
import { SectionFrame } from "../components/section-frame";
import { StatFigure } from "../components/stat-figure";
import { defaults } from "../presets/defaults";
import { cn } from "../utils";
import type { Stat } from "./stats-band.types";
export type StatsBandProps = {
id: string;
title?: string;
stats: Stat[];
empty?: string;
cols?: "2" | "3" | "4";
layout?: "row" | "stack";
surface?: "none" | "image" | "panel";
item?: "plain" | "card" | "icon";
align?: "start" | "center";
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function StatsBand({
id,
title = "",
stats,
empty = "",
cols = "4",
layout = "row",
surface = "none",
item = "plain",
align = "center",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: StatsBandProps) {
return (
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
align={align}
measure={
(surface as string) === "panel" ? "fill"
: (layout as string) === "stack" ? "xs"
: "default"
}
className={cn(
cn((((surface as string) === "image") ? "bg-transparent" : ""), (((surface as string) === "panel") ? "py-0" : "")),
(
(((surface as string) === "image") ? "image" : "none") === "image" ? "relative isolate overflow-hidden"
: ""
)
)}
landmarkLabel={landmarkLabel}
>
<Backdrop
kind={(((surface as string) === "image") ? "image" : "none")}
alt={(imageAlt ? imageAlt : title)}
image={image}
/>
{((stats?.length ?? 0) === 0) ? (
<EmptyState icon="chart-column" title={empty} />
) : ((surface as string) === "panel") ? (
<Grid
cols={
(cols as string) === "2" ? "2"
: (cols as string) === "3" ? "2-3"
: (cols as string) === "4" ? "2-4"
: "3-6"
}
className={cn("w-full items-center bg-muted px-6", defaults.stats.panel)}
data-slot="items"
>
{(stats ?? []).map((stat) => (
<StatFigure key={stat.id} stat={stat} item={item} align={align} />
))}
</Grid>
) : (
<Grid
cols={
(layout as string) === "stack" ? "1"
: (cols as string) === "2" ? "2"
: (cols as string) === "3" ? "2-3"
: (cols as string) === "4" ? "2-4"
: "3-6"
}
className="gap-6"
data-slot="items"
>
{(stats ?? []).map((stat) => (
<StatFigure key={stat.id} stat={stat} item={item} align={align} />
))}
</Grid>
)}
</SectionFrame>
);
}
// 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 Stat = {
id: string;
label: string;
value: string;
icon: string;
hint: string;
};
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 stats-band// 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 Stat = {
id: string;
label: string;
value: string;
icon: string;
hint: string;
};
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Key numbers in a row or grid: plain figures, cards (StatTile) or figures with an icon. Axes: columns (2, 3,
4), item (plain, card, icon), surface (none, image, panel: one rounded card), align, density, tone. Title may
be empty.
-->
<script lang="ts">
import type { Stat } from "./stats-band.types";
export type StatsBandProps = {
id: string;
title?: string;
stats: Stat[];
empty?: string;
cols?: "2" | "3" | "4";
layout?: "row" | "stack";
surface?: "none" | "image" | "panel";
item?: "plain" | "card" | "icon";
align?: "start" | "center";
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Grid from "../compose/Grid.vue";
import Backdrop from "../components/backdrop.vue";
import EmptyState from "../components/empty-state.vue";
import SectionFrame from "../components/section-frame.vue";
import StatFigure from "../components/stat-figure.vue";
import { defaults } from "../presets/defaults";
import { cn } from "../utils";
const {
id,
title = "",
stats,
empty = "",
cols = "4",
layout = "row",
surface = "none",
item = "plain",
align = "center",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
} = defineProps<StatsBandProps>();
</script>
<template>
<SectionFrame
:id="id"
:title="title"
:tone="tone"
:density="density"
:align="align"
:measure="
(surface as string) === 'panel' ? 'fill'
: (layout as string) === 'stack' ? 'xs'
: 'default'
"
:class="cn(
cn((((surface as string) === 'image') ? 'bg-transparent' : ''), (((surface as string) === 'panel') ? 'py-0' : '')),
(
(((surface as string) === 'image') ? 'image' : 'none') === 'image' ? 'relative isolate overflow-hidden'
: ''
)
)"
:landmarkLabel="landmarkLabel"
>
<Backdrop
:kind="(((surface as string) === 'image') ? 'image' : 'none')"
:alt="(imageAlt ? imageAlt : title)"
:image="image"
/>
<EmptyState v-if="((stats?.length ?? 0) === 0)" icon="chart-column" :title="empty" />
<Grid v-else-if="((surface as string) === 'panel')"
:cols="
(cols as string) === '2' ? '2'
: (cols as string) === '3' ? '2-3'
: (cols as string) === '4' ? '2-4'
: '3-6'
"
:class="cn('w-full items-center bg-muted px-6', defaults.stats.panel)"
data-slot="items"
>
<StatFigure v-for="stat in stats" :key="stat.id" :stat="stat" :item="item" :align="align" />
</Grid>
<Grid v-else
:cols="
(layout as string) === 'stack' ? '1'
: (cols as string) === '2' ? '2'
: (cols as string) === '3' ? '2-3'
: (cols as string) === '4' ? '2-4'
: '3-6'
"
class="gap-6"
data-slot="items"
>
<StatFigure v-for="stat in stats" :key="stat.id" :stat="stat" :item="item" :align="align" />
</Grid>
</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 stats-band// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Key numbers in a row or grid: plain figures, cards (StatTile) or figures with an icon. Axes: columns (2, 3,
* 4), item (plain, card, icon), surface (none, image, panel: one rounded card), align, density, tone. Title may
* be empty.
*/
import { For, type JSX } from "solid-js";
import { Grid } from "../compose";
import { Backdrop } from "../components/backdrop";
import { EmptyState } from "../components/empty-state";
import { SectionFrame } from "../components/section-frame";
import { StatFigure } from "../components/stat-figure";
import { defaults } from "../presets/defaults";
import { cn } from "../utils";
import type { Stat } from "./stats-band.types";
export type StatsBandProps = {
id: string;
title?: string;
stats: Stat[];
empty?: string;
cols?: "2" | "3" | "4";
layout?: "row" | "stack";
surface?: "none" | "image" | "panel";
item?: "plain" | "card" | "icon";
align?: "start" | "center";
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
image?: string;
imageAlt?: string;
landmarkLabel?: string;
};
export function StatsBand({
id,
title = "",
stats,
empty = "",
cols = "4",
layout = "row",
surface = "none",
item = "plain",
align = "center",
tone = "default",
density = "default",
image,
imageAlt,
landmarkLabel,
}: StatsBandProps) {
return (
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
align={align}
measure={
(surface as string) === "panel" ? "fill"
: (layout as string) === "stack" ? "xs"
: "default"
}
class={cn(
cn((((surface as string) === "image") ? "bg-transparent" : ""), (((surface as string) === "panel") ? "py-0" : "")),
(
(((surface as string) === "image") ? "image" : "none") === "image" ? "relative isolate overflow-hidden"
: ""
)
)}
landmarkLabel={landmarkLabel}
>
<Backdrop
kind={(((surface as string) === "image") ? "image" : "none")}
alt={(imageAlt ? imageAlt : title)}
image={image}
/>
{((stats?.length ?? 0) === 0) ? (
<EmptyState icon="chart-column" title={empty} />
) : ((surface as string) === "panel") ? (
<Grid
cols={
(cols as string) === "2" ? "2"
: (cols as string) === "3" ? "2-3"
: (cols as string) === "4" ? "2-4"
: "3-6"
}
class={cn("w-full items-center bg-muted px-6", defaults.stats.panel)}
data-slot="items"
>
<For each={stats ?? []}>{(stat) => (
<StatFigure stat={stat} item={item} align={align} />
)}</For>
</Grid>
) : (
<Grid
cols={
(layout as string) === "stack" ? "1"
: (cols as string) === "2" ? "2"
: (cols as string) === "3" ? "2-3"
: (cols as string) === "4" ? "2-4"
: "3-6"
}
class="gap-6"
data-slot="items"
>
<For each={stats ?? []}>{(stat) => (
<StatFigure stat={stat} item={item} align={align} />
)}</For>
</Grid>
)}
</SectionFrame>
);
}
// 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 Stat = {
id: string;
label: string;
value: string;
icon: string;
hint: string;
};
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 stats-band// 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/stats-band.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// StatsBandProps are the props of StatsBand; the values are the JSON shapes of the TypeScript props.
type StatsBandProps struct {
Id any `json:"id"`
Title any `json:"title"`
Stats any `json:"stats"`
Empty any `json:"empty"`
Cols any `json:"cols"`
Layout any `json:"layout"`
Surface any `json:"surface"`
Item any `json:"item"`
Align any `json:"align"`
Tone any `json:"tone"`
Density any `json:"density"`
Image any `json:"image"`
ImageAlt any `json:"imageAlt"`
LandmarkLabel any `json:"landmarkLabel"`
}
// Key numbers in a row or grid: plain figures, cards (StatTile) or figures with an icon. Axes: columns (2, 3, 4), item (plain, card, icon), surface (none, image, panel: one rounded card), align, density, tone. Title may be empty.
templ StatsBand(p StatsBandProps) {
{{ vId := p.Id }}
{{ vTitle := uiutils.Def(p.Title, "") }}
{{ vStats := p.Stats }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vCols := uiutils.Def(p.Cols, "4") }}
{{ vLayout := uiutils.Def(p.Layout, "row") }}
{{ vSurface := uiutils.Def(p.Surface, "none") }}
{{ vItem := uiutils.Def(p.Item, "plain") }}
{{ vAlign := uiutils.Def(p.Align, "center") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vDensity := uiutils.Def(p.Density, "default") }}
{{ vImage := p.Image }}
{{ vImageAlt := p.ImageAlt }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, Density: vDensity, Align: vAlign, Measure: uiutils.Cond(uiutils.T(uiutils.Eq(vSurface, "panel")), "fill", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "stack")), "xs", "default")), Class: uiutils.Cnv(uiutils.Cnv(uiutils.Cnv(uiutils.Cond(uiutils.T(uiutils.Eq(vSurface, "image")), "bg-transparent", ""), uiutils.Cond(uiutils.T(uiutils.Eq(vSurface, "panel")), "py-0", "")), uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Cond(uiutils.T(uiutils.Eq(vSurface, "image")), "image", "none"), "image")), "relative isolate overflow-hidden", ""))), LandmarkLabel: vLandmarkLabel}) {
@Backdrop(BackdropProps{Kind: uiutils.Cond(uiutils.T(uiutils.Eq(vSurface, "image")), "image", "none"), Alt: uiutils.Cond(uiutils.T(vImageAlt), vImageAlt, vTitle), Image: vImage})
if uiutils.Eq(uiutils.Len(vStats), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "chart-column", Title: vEmpty})
} else if uiutils.Eq(vSurface, "panel") {
@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "2")), "2", uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "3")), "2-3", uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "4")), "2-4", "3-6")))), BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("w-full items-center bg-muted px-6", uiutils.Get(presetDefaults, "stats", "panel"))), Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vStat := range uiutils.L(vStats) {
@StatFigure(StatFigureProps{Stat: vStat, Item: vItem, Align: vAlign})
}
}
} else {
@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "stack")), "1", uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "2")), "2", uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "3")), "2-3", uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "4")), "2-4", "3-6"))))), BoxProps: box.BoxProps{Class: "gap-6", Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vStat := range uiutils.L(vStats) {
@StatFigure(StatFigureProps{Stat: vStat, Item: vItem, Align: vAlign})
}
}
}
}
}
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 stats-band{#- 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/stats-band.json
Key numbers in a row or grid: plain figures, cards (StatTile) or figures with an icon. Axes: columns (2, 3, 4), item (plain, card, icon), surface (none, image, panel: one rounded card), align, density, tone. Title may be empty.
Props (p): id, title, stats, empty, cols, layout, surface, item, align, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? '') -%}
{%- set v_stats = (p.stats ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_cols = (p.cols ?? '4') -%}
{%- set v_layout = (p.layout ?? 'row') -%}
{%- set v_surface = (p.surface ?? 'none') -%}
{%- set v_item = (p.item ?? 'plain') -%}
{%- set v_align = (p.align ?? 'center') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_image = (p.image ?? null) -%}
{%- set v_imageAlt = (p.imageAlt ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_3 -%}
{{ include('blocks/backdrop.html.twig', {'p': {'kind': (og_t(og_eq(v_surface, 'image')) ? 'image' : 'none'), 'alt': (og_t(v_imageAlt) ? v_imageAlt : v_title), 'image': v_image}}, with_context = false) }}
{%- if og_t(og_eq(og_len(v_stats), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'chart-column', 'title': v_empty}}, with_context = false) }}
{%- elseif og_t(og_eq(v_surface, 'panel')) %}
{%- set c_1 -%}
{%- for v_stat in og_l(v_stats) %}
{{ include('blocks/stat-figure.html.twig', {'p': {'stat': v_stat, 'item': v_item, 'align': v_align}}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_cols, '2')) ? '2' : (og_t(og_eq(v_cols, '3')) ? '2-3' : (og_t(og_eq(v_cols, '4')) ? '2-4' : '3-6')))), 'class': og_s(og_cnv(['w-full items-center bg-muted px-6', og_preset('blocks/presets/defaults.json', ['stats', 'panel'])])), 'attrs': og_attrs(['data-slot', 'items']), 'children': c_1}, with_context = false) }}
{%- else %}
{%- set c_2 -%}
{%- for v_stat in og_l(v_stats) %}
{{ include('blocks/stat-figure.html.twig', {'p': {'stat': v_stat, 'item': v_item, 'align': v_align}}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_layout, 'stack')) ? '1' : (og_t(og_eq(v_cols, '2')) ? '2' : (og_t(og_eq(v_cols, '3')) ? '2-3' : (og_t(og_eq(v_cols, '4')) ? '2-4' : '3-6'))))), 'class': 'gap-6', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_2}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'align': v_align, 'measure': (og_t(og_eq(v_surface, 'panel')) ? 'fill' : (og_t(og_eq(v_layout, 'stack')) ? 'xs' : 'default')), 'className': og_cnv([og_cnv([og_cnv([(og_t(og_eq(v_surface, 'image')) ? 'bg-transparent' : ''), (og_t(og_eq(v_surface, 'panel')) ? 'py-0' : '')]), (og_t(og_eq((og_t(og_eq(v_surface, 'image')) ? 'image' : 'none'), 'image')) ? 'relative isolate overflow-hidden' : '')])]), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_3)}, 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 stats-band{* 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/stats-band.json
Key numbers in a row or grid: plain figures, cards (StatTile) or figures with an icon. Axes: columns (2, 3, 4), item (plain, card, icon), surface (none, image, panel: one rounded card), align, density, tone. Title may be empty.
Props (p): id, title, stats, empty, cols, layout, surface, item, align, tone, density, image, imageAlt, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? '')}
{var $v_stats = ($p['stats'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_cols = ($p['cols'] ?? '4')}
{var $v_layout = ($p['layout'] ?? 'row')}
{var $v_surface = ($p['surface'] ?? 'none')}
{var $v_item = ($p['item'] ?? 'plain')}
{var $v_align = ($p['align'] ?? 'center')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_image = ($p['image'] ?? null)}
{var $v_imageAlt = ($p['imageAlt'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_3}
{=og_include('blocks/backdrop.latte', ['p' => ['kind' => (og_t(og_eq($v_surface, 'image')) ? 'image' : 'none'), 'alt' => (og_t($v_imageAlt) ? $v_imageAlt : $v_title), 'image' => $v_image]])|noescape}
{if og_t(og_eq(og_len($v_stats), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'chart-column', 'title' => $v_empty]])|noescape}
{elseif og_t(og_eq($v_surface, 'panel'))}
{capture $c_1}
{foreach og_l($v_stats) as $v_stat}
{=og_include('blocks/stat-figure.latte', ['p' => ['stat' => $v_stat, 'item' => $v_item, 'align' => $v_align]])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_cols, '2')) ? '2' : (og_t(og_eq($v_cols, '3')) ? '2-3' : (og_t(og_eq($v_cols, '4')) ? '2-4' : '3-6')))), 'class' => og_s(og_cnv(['w-full items-center bg-muted px-6', og_preset('blocks/presets/defaults.json', ['stats', 'panel'])])), 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_1])|noescape}
{else}
{capture $c_2}
{foreach og_l($v_stats) as $v_stat}
{=og_include('blocks/stat-figure.latte', ['p' => ['stat' => $v_stat, 'item' => $v_item, 'align' => $v_align]])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_layout, 'stack')) ? '1' : (og_t(og_eq($v_cols, '2')) ? '2' : (og_t(og_eq($v_cols, '3')) ? '2-3' : (og_t(og_eq($v_cols, '4')) ? '2-4' : '3-6'))))), 'class' => 'gap-6', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_2])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'density' => $v_density, 'align' => $v_align, 'measure' => (og_t(og_eq($v_surface, 'panel')) ? 'fill' : (og_t(og_eq($v_layout, 'stack')) ? 'xs' : 'default')), 'className' => og_cnv([og_cnv([og_cnv([(og_t(og_eq($v_surface, 'image')) ? 'bg-transparent' : ''), (og_t(og_eq($v_surface, 'panel')) ? 'py-0' : '')]), (og_t(og_eq((og_t(og_eq($v_surface, 'image')) ? 'image' : 'none'), 'image')) ? 'relative isolate overflow-hidden' : '')])]), 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_3)])|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 stats-band{#- 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/stats-band.json
Key numbers in a row or grid: plain figures, cards (StatTile) or figures with an icon. Axes: columns (2, 3, 4), item (plain, card, icon), surface (none, image, panel: one rounded card), align, density, tone. Title may be empty.
Props (p): id, title, stats, empty, cols, layout, surface, item, align, tone, density, image, imageAlt, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], '') -%}
{%- set v_stats = og_def(p['stats'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_cols = og_def(p['cols'], '4') -%}
{%- set v_layout = og_def(p['layout'], 'row') -%}
{%- set v_surface = og_def(p['surface'], 'none') -%}
{%- set v_item = og_def(p['item'], 'plain') -%}
{%- set v_align = og_def(p['align'], 'center') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_image = og_def(p['image'], none) -%}
{%- set v_imageAlt = og_def(p['imageAlt'], none) -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_3 -%}
{{ og_include('blocks/backdrop.html.j2', {'p': {'kind': ('image' if og_t(og_eq(v_surface, 'image')) else 'none'), 'alt': (v_imageAlt if og_t(v_imageAlt) else v_title), 'image': v_image}}) }}
{%- if og_t(og_eq(og_len(v_stats), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'chart-column', 'title': v_empty}}) }}
{%- elif og_t(og_eq(v_surface, 'panel')) %}
{%- set c_1 -%}
{%- for v_stat in og_l(v_stats) %}
{{ og_include('blocks/stat-figure.html.j2', {'p': {'stat': v_stat, 'item': v_item, 'align': v_align}}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('2' if og_t(og_eq(v_cols, '2')) else ('2-3' if og_t(og_eq(v_cols, '3')) else ('2-4' if og_t(og_eq(v_cols, '4')) else '3-6')))), 'Class': og_s(og_cnv(['w-full items-center bg-muted px-6', og_preset('blocks/presets/defaults.json', ['stats', 'panel'])])), 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_1}) }}
{%- else %}
{%- set c_2 -%}
{%- for v_stat in og_l(v_stats) %}
{{ og_include('blocks/stat-figure.html.j2', {'p': {'stat': v_stat, 'item': v_item, 'align': v_align}}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('1' if og_t(og_eq(v_layout, 'stack')) else ('2' if og_t(og_eq(v_cols, '2')) else ('2-3' if og_t(og_eq(v_cols, '3')) else ('2-4' if og_t(og_eq(v_cols, '4')) else '3-6'))))), 'Class': 'gap-6', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_2}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'align': v_align, 'measure': ('fill' if og_t(og_eq(v_surface, 'panel')) else ('xs' if og_t(og_eq(v_layout, 'stack')) else 'default')), 'className': og_cnv([og_cnv([og_cnv([('bg-transparent' if og_t(og_eq(v_surface, 'image')) else ''), ('py-0' if og_t(og_eq(v_surface, 'panel')) else '')]), ('relative isolate overflow-hidden' if og_t(og_eq(('image' if og_t(og_eq(v_surface, 'image')) else 'none'), 'image')) else '')])]), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_3)}) }}
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.
Key numbers in a row or grid: plain figures, cards (StatTile) or figures with an icon. Axes: columns (2, 3, 4), item (plain, card, icon), surface (none, image, panel: one rounded card), align, density, tone. Title may be empty.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title | string | "" | |
| stats (required) | Stat[] | - | |
| empty | string | "" | the text of the empty state (no figures), from the dictionary |
| cols | "2" | "3" | "4" | "4" | |
| layout | "row" | "stack" | "row" | stack: one narrow column of figures, for a sidebar |
| surface | "none" | "image" | "panel" | "none" | image: picture behind; panel: one rounded card |
| item | "plain" | "card" | "icon" | "plain" | |
| align | "start" | "center" | "center" | |
| tone | "default" | "muted" | "default" | |
| density | "roomy" | "default" | "compact" | "default" | |
| image | string | - | address of the picture (an https URL or a path); none: the placeholder |
| imageAlt | string | - | alt text of the picture; none: the title |
| 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 |