Order Table
Past orders with status.
Install
npx ui8kit add order-tablePulls in: card, card-content, compose, empty-state, kit-box, kit-text, order-rows, pager, pill, section-frame, stack, text, utils
Preview
Your orders
| Order | Date | Items | Total | Status |
|---|---|---|---|---|
| Order 1042 | Mar 28, 2026 | 4 items | $324 | Shipped |
| Order 1041 | Mar 21, 2026 | 1 items | $89 | Paid |
| Order 1038 | Mar 09, 2026 | 1 items | $199 | Pending |
| Order 1031 | Feb 24, 2026 | 1 items | $50 | Refunded |
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 order-table<!-- 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 order history as a table or as cards: number, date, items, total and a status pill, with an optional
pager. Axes: layout (table, cards), pager (show, hide), tone, density.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Order, OrderLabels } from "./order-table.types";
export type OrderTableProps = {
id: string;
title: string;
orders: Order[];
empty?: string;
statuses: Record<string, string>;
labels: OrderLabels;
layout?: "table" | "cards";
pager?: "show" | "hide";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Card from "../compose/Card.svelte";
import CardContent from "../compose/CardContent.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import EmptyState from "../components/empty-state.svelte";
import OrderRows from "../components/order-rows.svelte";
import Pager from "../components/pager.svelte";
import Pill from "../components/pill.svelte";
import SectionFrame from "../components/section-frame.svelte";
import { at, fmtMoney, tpl } from "../utils";
let {
id,
title,
orders,
empty = "",
statuses,
labels,
layout = "table",
pager = "show",
tone = "default",
density = "default",
landmarkLabel,
}: OrderTableProps = $props();
</script>
<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{#if ((orders?.length ?? 0) === 0)}
<EmptyState icon="package" title={empty} />
{:else}
<Stack gap="4" align="stretch">
{#if ((layout as string) === "table")}
<OrderRows orders={orders} statuses={statuses} labels={labels} density={density} />
{:else}
<Stack gap="4" align="stretch" data-slot="order-cards">
{#each orders as o (o.id)}
<Card variant="default">
<CardContent class="flex flex-wrap items-center justify-between gap-4">
<Stack gap="0">
<Text size="sm" weight="semibold">
{o.number}
</Text>
<Text size="xs" class="text-muted-foreground">
{o.date}
</Text>
</Stack>
<Text size="sm">
{tpl(labels.itemsCount, o.items)}
</Text>
<Text size="sm" weight="bold">
{fmtMoney(o.total, o.currency)}
</Text>
<Pill
tone={
o.status === "paid" ? "green"
: o.status === "shipped" ? "blue"
: o.status === "pending" ? "amber"
: "gray"
}
>
{at(statuses, o.status)}
</Pill>
</CardContent>
</Card>
{/each}
</Stack>
{/if}
{#if ((pager as string) === "show")}
<Pager
page={1}
pages={3}
summary={tpl(labels.summary, 1, 4, 12)}
previousLabel={labels.previous}
nextLabel={labels.next}
/>
{/if}
</Stack>
{/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 Order = {
id: string;
number: string;
date: string;
total: number;
currency: string;
status: string;
items: number;
};
export type OrderLabels = {
caption: string;
number: string;
date: string;
items: string;
total: string;
status: string;
itemsCount: string;
summary: string;
previous: string;
next: 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 order-table// 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 order history as a table or as cards: number, date, items, total and a status pill, with an optional
* pager. Axes: layout (table, cards), pager (show, hide), tone, density.
*/
import { type ReactNode } from "react";
import { Card, CardContent, Stack, Text } from "../compose";
import { EmptyState } from "../components/empty-state";
import { OrderRows } from "../components/order-rows";
import { Pager } from "../components/pager";
import { Pill } from "../components/pill";
import { SectionFrame } from "../components/section-frame";
import { at, fmtMoney, tpl } from "../utils";
import type { Order, OrderLabels } from "./order-table.types";
export type OrderTableProps = {
id: string;
title: string;
orders: Order[];
empty?: string;
statuses: Record<string, string>;
labels: OrderLabels;
layout?: "table" | "cards";
pager?: "show" | "hide";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function OrderTable({
id,
title,
orders,
empty = "",
statuses,
labels,
layout = "table",
pager = "show",
tone = "default",
density = "default",
landmarkLabel,
}: OrderTableProps) {
return (
<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{((orders?.length ?? 0) === 0) ? (
<EmptyState icon="package" title={empty} />
) : (
<Stack gap="4" align="stretch">
{((layout as string) === "table") ? (
<OrderRows orders={orders} statuses={statuses} labels={labels} density={density} />
) : (
<Stack gap="4" align="stretch" data-slot="order-cards">
{(orders ?? []).map((o) => (
<Card key={o.id} variant="default">
<CardContent className="flex flex-wrap items-center justify-between gap-4">
<Stack gap="0">
<Text size="sm" weight="semibold">
{o.number}
</Text>
<Text size="xs" className="text-muted-foreground">
{o.date}
</Text>
</Stack>
<Text size="sm">
{tpl(labels.itemsCount, o.items)}
</Text>
<Text size="sm" weight="bold">
{fmtMoney(o.total, o.currency)}
</Text>
<Pill
tone={
o.status === "paid" ? "green"
: o.status === "shipped" ? "blue"
: o.status === "pending" ? "amber"
: "gray"
}
>
{at(statuses, o.status)}
</Pill>
</CardContent>
</Card>
))}
</Stack>
)}
{((pager as string) === "show") ? (
<Pager
page={1}
pages={3}
summary={tpl(labels.summary, 1, 4, 12)}
previousLabel={labels.previous}
nextLabel={labels.next}
/>
) : null}
</Stack>
)}
</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 Order = {
id: string;
number: string;
date: string;
total: number;
currency: string;
status: string;
items: number;
};
export type OrderLabels = {
caption: string;
number: string;
date: string;
items: string;
total: string;
status: string;
itemsCount: string;
summary: string;
previous: string;
next: 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 order-table// 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 Order = {
id: string;
number: string;
date: string;
total: number;
currency: string;
status: string;
items: number;
};
export type OrderLabels = {
caption: string;
number: string;
date: string;
items: string;
total: string;
status: string;
itemsCount: string;
summary: string;
previous: string;
next: 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. -->
<!--
The order history as a table or as cards: number, date, items, total and a status pill, with an optional
pager. Axes: layout (table, cards), pager (show, hide), tone, density.
-->
<script lang="ts">
import type { Order, OrderLabels } from "./order-table.types";
export type OrderTableProps = {
id: string;
title: string;
orders: Order[];
empty?: string;
statuses: Record<string, string>;
labels: OrderLabels;
layout?: "table" | "cards";
pager?: "show" | "hide";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Card from "../compose/Card.vue";
import CardContent from "../compose/CardContent.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import EmptyState from "../components/empty-state.vue";
import OrderRows from "../components/order-rows.vue";
import Pager from "../components/pager.vue";
import Pill from "../components/pill.vue";
import SectionFrame from "../components/section-frame.vue";
import { at, fmtMoney, tpl } from "../utils";
const {
id,
title,
orders,
empty = "",
statuses,
labels,
layout = "table",
pager = "show",
tone = "default",
density = "default",
landmarkLabel,
} = defineProps<OrderTableProps>();
</script>
<template>
<SectionFrame :id="id" :title="title" :tone="tone" :density="density" :landmarkLabel="landmarkLabel">
<EmptyState v-if="((orders?.length ?? 0) === 0)" icon="package" :title="empty" />
<Stack v-else gap="4" align="stretch">
<OrderRows
v-if="((layout as string) === 'table')"
:orders="orders"
:statuses="statuses"
:labels="labels"
:density="density"
/>
<Stack v-else gap="4" align="stretch" data-slot="order-cards">
<Card v-for="o in orders" :key="o.id" variant="default">
<CardContent class="flex flex-wrap items-center justify-between gap-4">
<Stack gap="0">
<Text size="sm" weight="semibold">
{{ o.number }}
</Text>
<Text size="xs" class="text-muted-foreground">
{{ o.date }}
</Text>
</Stack>
<Text size="sm">
{{ tpl(labels.itemsCount, o.items) }}
</Text>
<Text size="sm" weight="bold">
{{ fmtMoney(o.total, o.currency) }}
</Text>
<Pill
:tone="
o.status === 'paid' ? 'green'
: o.status === 'shipped' ? 'blue'
: o.status === 'pending' ? 'amber'
: 'gray'
"
>
{{ at(statuses, o.status) }}
</Pill>
</CardContent>
</Card>
</Stack>
<Pager v-if="((pager as string) === 'show')"
:page="1"
:pages="3"
:summary="tpl(labels.summary, 1, 4, 12)"
:previousLabel="labels.previous"
:nextLabel="labels.next"
/>
</Stack>
</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 order-table// 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 order history as a table or as cards: number, date, items, total and a status pill, with an optional
* pager. Axes: layout (table, cards), pager (show, hide), tone, density.
*/
import { For, type JSX } from "solid-js";
import { Card, CardContent, Stack, Text } from "../compose";
import { EmptyState } from "../components/empty-state";
import { OrderRows } from "../components/order-rows";
import { Pager } from "../components/pager";
import { Pill } from "../components/pill";
import { SectionFrame } from "../components/section-frame";
import { at, fmtMoney, tpl } from "../utils";
import type { Order, OrderLabels } from "./order-table.types";
export type OrderTableProps = {
id: string;
title: string;
orders: Order[];
empty?: string;
statuses: Record<string, string>;
labels: OrderLabels;
layout?: "table" | "cards";
pager?: "show" | "hide";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function OrderTable({
id,
title,
orders,
empty = "",
statuses,
labels,
layout = "table",
pager = "show",
tone = "default",
density = "default",
landmarkLabel,
}: OrderTableProps) {
return (
<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{((orders?.length ?? 0) === 0) ? (
<EmptyState icon="package" title={empty} />
) : (
<Stack gap="4" align="stretch">
{((layout as string) === "table") ? (
<OrderRows orders={orders} statuses={statuses} labels={labels} density={density} />
) : (
<Stack gap="4" align="stretch" data-slot="order-cards">
<For each={orders ?? []}>{(o) => (
<Card variant="default">
<CardContent class="flex flex-wrap items-center justify-between gap-4">
<Stack gap="0">
<Text size="sm" weight="semibold">
{o.number}
</Text>
<Text size="xs" class="text-muted-foreground">
{o.date}
</Text>
</Stack>
<Text size="sm">
{tpl(labels.itemsCount, o.items)}
</Text>
<Text size="sm" weight="bold">
{fmtMoney(o.total, o.currency)}
</Text>
<Pill
tone={
o.status === "paid" ? "green"
: o.status === "shipped" ? "blue"
: o.status === "pending" ? "amber"
: "gray"
}
>
{at(statuses, o.status)}
</Pill>
</CardContent>
</Card>
)}</For>
</Stack>
)}
{((pager as string) === "show") ? (
<Pager
page={1}
pages={3}
summary={tpl(labels.summary, 1, 4, 12)}
previousLabel={labels.previous}
nextLabel={labels.next}
/>
) : null}
</Stack>
)}
</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 Order = {
id: string;
number: string;
date: string;
total: number;
currency: string;
status: string;
items: number;
};
export type OrderLabels = {
caption: string;
number: string;
date: string;
items: string;
total: string;
status: string;
itemsCount: string;
summary: string;
previous: string;
next: 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 order-table// 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/order-table.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/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// OrderTableProps are the props of OrderTable; the values are the JSON shapes of the TypeScript props.
type OrderTableProps struct {
Id any `json:"id"`
Title any `json:"title"`
Orders any `json:"orders"`
Empty any `json:"empty"`
Statuses any `json:"statuses"`
Labels any `json:"labels"`
Layout any `json:"layout"`
Pager any `json:"pager"`
Tone any `json:"tone"`
Density any `json:"density"`
LandmarkLabel any `json:"landmarkLabel"`
}
// The order history as a table or as cards: number, date, items, total and a status pill, with an optional pager. Axes: layout (table, cards), pager (show, hide), tone, density.
templ OrderTable(p OrderTableProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vOrders := p.Orders }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vStatuses := p.Statuses }}
{{ vLabels := p.Labels }}
{{ vLayout := uiutils.Def(p.Layout, "table") }}
{{ vPager := uiutils.Def(p.Pager, "show") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vDensity := uiutils.Def(p.Density, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, Density: vDensity, LandmarkLabel: vLandmarkLabel}) {
if uiutils.Eq(uiutils.Len(vOrders), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "package", Title: vEmpty})
} else {
@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{}}) {
if uiutils.Eq(vLayout, "table") {
@OrderRows(OrderRowsProps{Orders: vOrders, Statuses: vStatuses, Labels: vLabels, Density: vDensity})
} else {
@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "order-cards")}}) {
for _, vO := range uiutils.L(vOrders) {
@compose.Card(compose.CardProps{Variant: "default", BoxProps: box.BoxProps{}}) {
@compose.CardContent(compose.CardContentProps{BoxProps: box.BoxProps{Class: "flex flex-wrap items-center justify-between gap-4"}}) {
@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{}}) {
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vO, "number")) }
}
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vO, "date")) }
}
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "itemsCount"), uiutils.Get(vO, "items"))) }
}
@compose.Text(compose.TextProps{Size: "sm", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Money(uiutils.Get(vO, "total"), uiutils.Get(vO, "currency"))) }
}
@Pill(PillProps{Tone: uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vO, "status"), "paid")), "green", uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vO, "status"), "shipped")), "blue", uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vO, "status"), "pending")), "amber", "gray")))}) {
{ uiutils.Text(uiutils.At(vStatuses, uiutils.Get(vO, "status"))) }
}
}
}
}
}
}
if uiutils.Eq(vPager, "show") {
@Pager(PagerProps{Page: float64(1), Pages: float64(3), Summary: uiutils.Tpl(uiutils.Get(vLabels, "summary"), float64(1), float64(4), float64(12)), PreviousLabel: uiutils.Get(vLabels, "previous"), NextLabel: uiutils.Get(vLabels, "next")})
}
}
}
}
}
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 order-table{#- 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/order-table.json
The order history as a table or as cards: number, date, items, total and a status pill, with an optional pager. Axes: layout (table, cards), pager (show, hide), tone, density.
Props (p): id, title, orders, empty, statuses, labels, layout, pager, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_orders = (p.orders ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_statuses = (p.statuses ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'table') -%}
{%- set v_pager = (p.pager ?? 'show') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_11 -%}
{%- if og_t(og_eq(og_len(v_orders), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'package', 'title': v_empty}}, with_context = false) }}
{%- else %}
{%- set c_10 -%}
{%- if og_t(og_eq(v_layout, 'table')) %}
{{ include('blocks/order-rows.html.twig', {'p': {'orders': v_orders, 'statuses': v_statuses, 'labels': v_labels, 'density': v_density}}, with_context = false) }}
{%- else %}
{%- set c_9 -%}
{%- for v_o in og_l(v_orders) %}
{%- set c_8 -%}
{%- set c_7 -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_o, ['number'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_get(v_o, ['date'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '0', 'children': c_3}, with_context = false) }}
{%- set c_4 -%}
{{ og_text(og_tpl(og_get(v_labels, ['itemsCount']), [og_get(v_o, ['items'])])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'children': c_4}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_money(og_get(v_o, ['total']), og_get(v_o, ['currency']))) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'bold', 'children': c_5}, with_context = false) }}
{%- set c_6 -%}
{{ og_text(og_at(v_statuses, og_get(v_o, ['status']))) }}
{%- endset -%}
{{ include('blocks/pill.html.twig', {'p': {'tone': (og_t(og_eq(og_get(v_o, ['status']), 'paid')) ? 'green' : (og_t(og_eq(og_get(v_o, ['status']), 'shipped')) ? 'blue' : (og_t(og_eq(og_get(v_o, ['status']), 'pending')) ? 'amber' : 'gray')))}, 'children': og_markup(c_6)}, with_context = false) }}
{%- endset -%}
{{ include('compose/CardContent.html.twig', {'class': 'flex flex-wrap items-center justify-between gap-4', 'children': c_7}, with_context = false) }}
{%- endset -%}
{{ include('compose/Card.html.twig', {'variant': 'default', 'children': c_8}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'order-cards']), 'children': c_9}, with_context = false) }}
{%- endif %}
{%- if og_t(og_eq(v_pager, 'show')) %}
{{ include('blocks/pager.html.twig', {'p': {'page': 1, 'pages': 3, 'summary': og_tpl(og_get(v_labels, ['summary']), [1, 4, 12]), 'previousLabel': og_get(v_labels, ['previous']), 'nextLabel': og_get(v_labels, ['next'])}}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'children': c_10}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_11)}, 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 order-table{* 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/order-table.json
The order history as a table or as cards: number, date, items, total and a status pill, with an optional pager. Axes: layout (table, cards), pager (show, hide), tone, density.
Props (p): id, title, orders, empty, statuses, labels, layout, pager, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_orders = ($p['orders'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_statuses = ($p['statuses'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'table')}
{var $v_pager = ($p['pager'] ?? 'show')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_11}
{if og_t(og_eq(og_len($v_orders), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'package', 'title' => $v_empty]])|noescape}
{else}
{capture $c_10}
{if og_t(og_eq($v_layout, 'table'))}
{=og_include('blocks/order-rows.latte', ['p' => ['orders' => $v_orders, 'statuses' => $v_statuses, 'labels' => $v_labels, 'density' => $v_density]])|noescape}
{else}
{capture $c_9}
{foreach og_l($v_orders) as $v_o}
{capture $c_8}
{capture $c_7}
{capture $c_3}
{capture $c_1}
{=og_text(og_get($v_o, ['number']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_text(og_get($v_o, ['date']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '0', 'children' => (string) $c_3])|noescape}
{capture $c_4}
{=og_text(og_tpl(og_get($v_labels, ['itemsCount']), [og_get($v_o, ['items'])]))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'children' => (string) $c_4])|noescape}
{capture $c_5}
{=og_text(og_money(og_get($v_o, ['total']), og_get($v_o, ['currency'])))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'bold', 'children' => (string) $c_5])|noescape}
{capture $c_6}
{=og_text(og_at($v_statuses, og_get($v_o, ['status'])))}
{/capture}
{=og_include('blocks/pill.latte', ['p' => ['tone' => (og_t(og_eq(og_get($v_o, ['status']), 'paid')) ? 'green' : (og_t(og_eq(og_get($v_o, ['status']), 'shipped')) ? 'blue' : (og_t(og_eq(og_get($v_o, ['status']), 'pending')) ? 'amber' : 'gray')))], 'children' => og_markup($c_6)])|noescape}
{/capture}
{=og_include('compose/CardContent.latte', ['class' => 'flex flex-wrap items-center justify-between gap-4', 'children' => (string) $c_7])|noescape}
{/capture}
{=og_include('compose/Card.latte', ['variant' => 'default', 'children' => (string) $c_8])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'order-cards']), 'children' => (string) $c_9])|noescape}
{/if}
{if og_t(og_eq($v_pager, 'show'))}
{=og_include('blocks/pager.latte', ['p' => ['page' => 1, 'pages' => 3, 'summary' => og_tpl(og_get($v_labels, ['summary']), [1, 4, 12]), 'previousLabel' => og_get($v_labels, ['previous']), 'nextLabel' => og_get($v_labels, ['next'])]])|noescape}
{/if}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'children' => (string) $c_10])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'density' => $v_density, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_11)])|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 order-table{#- 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/order-table.json
The order history as a table or as cards: number, date, items, total and a status pill, with an optional pager. Axes: layout (table, cards), pager (show, hide), tone, density.
Props (p): id, title, orders, empty, statuses, labels, layout, pager, tone, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_orders = og_def(p['orders'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_statuses = og_def(p['statuses'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'table') -%}
{%- set v_pager = og_def(p['pager'], 'show') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_11 -%}
{%- if og_t(og_eq(og_len(v_orders), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'package', 'title': v_empty}}) }}
{%- else %}
{%- set c_10 -%}
{%- if og_t(og_eq(v_layout, 'table')) %}
{{ og_include('blocks/order-rows.html.j2', {'p': {'orders': v_orders, 'statuses': v_statuses, 'labels': v_labels, 'density': v_density}}) }}
{%- else %}
{%- set c_9 -%}
{%- for v_o in og_l(v_orders) %}
{%- set c_8 -%}
{%- set c_7 -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_o, ['number'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_text(og_get(v_o, ['date'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '0'}, 'children': c_3}) }}
{%- set c_4 -%}
{{ og_text(og_tpl(og_get(v_labels, ['itemsCount']), [og_get(v_o, ['items'])])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm'}, 'children': c_4}) }}
{%- set c_5 -%}
{{ og_text(og_money(og_get(v_o, ['total']), og_get(v_o, ['currency']))) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'bold'}, 'children': c_5}) }}
{%- set c_6 -%}
{{ og_text(og_at(v_statuses, og_get(v_o, ['status']))) }}
{%- endset -%}
{{ og_include('blocks/pill.html.j2', {'p': {'tone': ('green' if og_t(og_eq(og_get(v_o, ['status']), 'paid')) else ('blue' if og_t(og_eq(og_get(v_o, ['status']), 'shipped')) else ('amber' if og_t(og_eq(og_get(v_o, ['status']), 'pending')) else 'gray')))}, 'children': og_markup(c_6)}) }}
{%- endset -%}
{{ og_include('compose/card-content.html.j2', {'p': {'Class': 'flex flex-wrap items-center justify-between gap-4'}, 'children': c_7}) }}
{%- endset -%}
{{ og_include('compose/card.html.j2', {'p': {'Variant': 'default'}, 'children': c_8}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'order-cards'])}, 'children': c_9}) }}
{%- endif %}
{%- if og_t(og_eq(v_pager, 'show')) %}
{{ og_include('blocks/pager.html.j2', {'p': {'page': 1, 'pages': 3, 'summary': og_tpl(og_get(v_labels, ['summary']), [1, 4, 12]), 'previousLabel': og_get(v_labels, ['previous']), 'nextLabel': og_get(v_labels, ['next'])}}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch'}, 'children': c_10}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_11)}) }}
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 order history as a table or as cards: number, date, items, total and a status pill, with an optional pager. Axes: layout (table, cards), pager (show, hide), tone, density.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| orders (required) | Order[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| statuses (required) | Record<string, string> | - | word by order status |
| labels (required) | OrderLabels | - | |
| layout | "table" | "cards" | "table" | |
| pager | "show" | "hide" | "show" | |
| tone | "default" | "muted" | "default" | |
| density | "default" | "compact" | "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 |