Skip to content
ui8kit

component / components

Order Rows

Order Rows component

Install

npx ui8kit add order-rows

Pulls in: box, compose, kit-box, order-table, pill, table, table-body, table-caption, table-cell, table-head, table-head-cell, table-row, utils

Preview

Past orders
OrderDateItemsTotalStatus
Order 1042Mar 28, 20264 items$324
Shipped
Order 1041Mar 21, 20261 items$89
Paid
Order 1038Mar 09, 20261 items$199
Pending
Order 1031Feb 24, 20261 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-cdn
npx ui8kit add order-rows
components/order-rows.svelte
<!-- 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 orders as a table (the table layout of OrderTable): number, date, items, total and a status pill. -->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Order, OrderLabels } from "../blocks/order-table.types";

  export type OrderRowsProps = {
    orders: Order[];
    statuses: Record<string, string>;
    labels: OrderLabels;
    density?: "default" | "compact";
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Table from "../compose/Table.svelte";
  import TableBody from "../compose/TableBody.svelte";
  import TableCaption from "../compose/TableCaption.svelte";
  import TableCell from "../compose/TableCell.svelte";
  import TableHead from "../compose/TableHead.svelte";
  import TableHeadCell from "../compose/TableHeadCell.svelte";
  import TableRow from "../compose/TableRow.svelte";
  import Pill from "../components/pill.svelte";
  import { at, cn, fmtMoney, tpl } from "../utils";

  let { orders, statuses, labels, density = "default" }: OrderRowsProps = $props();
</script>

<Box class="w-full overflow-x-auto" data-slot="order-rows">
  <Table class="w-full text-left text-sm" data-slot="order-table">
    <TableCaption class="sr-only">
      {labels.caption}
    </TableCaption>
    <TableHead>
      <TableRow>
        <TableHeadCell scope="col" class="py-2">
          {labels.number}
        </TableHeadCell>
        <TableHeadCell scope="col" class="py-2">
          {labels.date}
        </TableHeadCell>
        <TableHeadCell scope="col" class="py-2">
          {labels.items}
        </TableHeadCell>
        <TableHeadCell scope="col" class="py-2">
          {labels.total}
        </TableHeadCell>
        <TableHeadCell scope="col" class="py-2">
          {labels.status}
        </TableHeadCell>
      </TableRow>
    </TableHead>
    <TableBody>
      {#each orders as o (o.id)}
        <TableRow class="border-t border-border" data-slot="item">
          <TableCell class={cn("font-semibold", (((density as string) === "compact") ? "py-2" : "py-4"))}>
            {o.number}
          </TableCell>
          <TableCell>
            {o.date}
          </TableCell>
          <TableCell>
            {tpl(labels.itemsCount, o.items)}
          </TableCell>
          <TableCell>
            {fmtMoney(o.total, o.currency)}
          </TableCell>
          <TableCell>
            <Pill
              tone={
                o.status === "paid" ? "green"
                : o.status === "shipped" ? "blue"
                : o.status === "pending" ? "amber"
                : "gray"
              }
            >
              {at(statuses, o.status)}
            </Pill>
          </TableCell>
        </TableRow>
      {/each}
    </TableBody>
  </Table>
</Box>

Svelte registry item (JSON)

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-cdn
npx ui8kit add order-rows
components/order-rows.tsx
// 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 orders as a table (the table layout of OrderTable): number, date, items, total and a status pill. */
import { type ReactNode } from "react";
import { Box, Table, TableBody, TableCaption, TableCell, TableHead, TableHeadCell, TableRow } from "../compose";
import { Pill } from "../components/pill";
import { at, cn, fmtMoney, tpl } from "../utils";
import type { Order, OrderLabels } from "../blocks/order-table.types";

export type OrderRowsProps = {
  orders: Order[];
  statuses: Record<string, string>;
  labels: OrderLabels;
  density?: "default" | "compact";
};

export function OrderRows({ orders, statuses, labels, density = "default" }: OrderRowsProps) {
  return (
    <Box className="w-full overflow-x-auto" data-slot="order-rows">
      <Table className="w-full text-left text-sm" data-slot="order-table">
        <TableCaption className="sr-only">
          {labels.caption}
        </TableCaption>
        <TableHead>
          <TableRow>
            <TableHeadCell scope="col" className="py-2">
              {labels.number}
            </TableHeadCell>
            <TableHeadCell scope="col" className="py-2">
              {labels.date}
            </TableHeadCell>
            <TableHeadCell scope="col" className="py-2">
              {labels.items}
            </TableHeadCell>
            <TableHeadCell scope="col" className="py-2">
              {labels.total}
            </TableHeadCell>
            <TableHeadCell scope="col" className="py-2">
              {labels.status}
            </TableHeadCell>
          </TableRow>
        </TableHead>
        <TableBody>
          {(orders ?? []).map((o) => (
            <TableRow key={o.id} className="border-t border-border" data-slot="item">
              <TableCell className={cn("font-semibold", (((density as string) === "compact") ? "py-2" : "py-4"))}>
                {o.number}
              </TableCell>
              <TableCell>
                {o.date}
              </TableCell>
              <TableCell>
                {tpl(labels.itemsCount, o.items)}
              </TableCell>
              <TableCell>
                {fmtMoney(o.total, o.currency)}
              </TableCell>
              <TableCell>
                <Pill
                  tone={
                    o.status === "paid" ? "green"
                    : o.status === "shipped" ? "blue"
                    : o.status === "pending" ? "amber"
                    : "gray"
                  }
                >
                  {at(statuses, o.status)}
                </Pill>
              </TableCell>
            </TableRow>
          ))}
        </TableBody>
      </Table>
    </Box>
  );
}

React registry item (JSON)

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-cdn
npx ui8kit add order-rows
components/order-rows.vue
<!-- 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 orders as a table (the table layout of OrderTable): number, date, items, total and a status pill. -->
<script lang="ts">
import type { Order, OrderLabels } from "../blocks/order-table.types";

export type OrderRowsProps = {
  orders: Order[];
  statuses: Record<string, string>;
  labels: OrderLabels;
  density?: "default" | "compact";
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Table from "../compose/Table.vue";
import TableBody from "../compose/TableBody.vue";
import TableCaption from "../compose/TableCaption.vue";
import TableCell from "../compose/TableCell.vue";
import TableHead from "../compose/TableHead.vue";
import TableHeadCell from "../compose/TableHeadCell.vue";
import TableRow from "../compose/TableRow.vue";
import Pill from "../components/pill.vue";
import { at, cn, fmtMoney, tpl } from "../utils";

const { orders, statuses, labels, density = "default" } = defineProps<OrderRowsProps>();
</script>

<template>
  <Box class="w-full overflow-x-auto" data-slot="order-rows">
    <Table class="w-full text-left text-sm" data-slot="order-table">
      <TableCaption class="sr-only">
        {{ labels.caption }}
      </TableCaption>
      <TableHead>
        <TableRow>
          <TableHeadCell scope="col" class="py-2">
            {{ labels.number }}
          </TableHeadCell>
          <TableHeadCell scope="col" class="py-2">
            {{ labels.date }}
          </TableHeadCell>
          <TableHeadCell scope="col" class="py-2">
            {{ labels.items }}
          </TableHeadCell>
          <TableHeadCell scope="col" class="py-2">
            {{ labels.total }}
          </TableHeadCell>
          <TableHeadCell scope="col" class="py-2">
            {{ labels.status }}
          </TableHeadCell>
        </TableRow>
      </TableHead>
      <TableBody>
        <TableRow v-for="o in orders" :key="o.id" class="border-t border-border" data-slot="item">
          <TableCell :class="cn('font-semibold', (((density as string) === 'compact') ? 'py-2' : 'py-4'))">
            {{ o.number }}
          </TableCell>
          <TableCell>
            {{ o.date }}
          </TableCell>
          <TableCell>
            {{ tpl(labels.itemsCount, o.items) }}
          </TableCell>
          <TableCell>
            {{ fmtMoney(o.total, o.currency) }}
          </TableCell>
          <TableCell>
            <Pill
              :tone="
                o.status === 'paid' ? 'green'
                : o.status === 'shipped' ? 'blue'
                : o.status === 'pending' ? 'amber'
                : 'gray'
              "
            >
              {{ at(statuses, o.status) }}
            </Pill>
          </TableCell>
        </TableRow>
      </TableBody>
    </Table>
  </Box>
</template>

Vue registry item (JSON)

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-cdn
npx ui8kit add order-rows
components/order-rows.tsx
// 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 orders as a table (the table layout of OrderTable): number, date, items, total and a status pill. */
import { For, type JSX } from "solid-js";
import { Box, Table, TableBody, TableCaption, TableCell, TableHead, TableHeadCell, TableRow } from "../compose";
import { Pill } from "../components/pill";
import { at, cn, fmtMoney, tpl } from "../utils";
import type { Order, OrderLabels } from "../blocks/order-table.types";

export type OrderRowsProps = {
  orders: Order[];
  statuses: Record<string, string>;
  labels: OrderLabels;
  density?: "default" | "compact";
};

export function OrderRows({ orders, statuses, labels, density = "default" }: OrderRowsProps) {
  return (
    <Box class="w-full overflow-x-auto" data-slot="order-rows">
      <Table class="w-full text-left text-sm" data-slot="order-table">
        <TableCaption class="sr-only">
          {labels.caption}
        </TableCaption>
        <TableHead>
          <TableRow>
            <TableHeadCell scope="col" class="py-2">
              {labels.number}
            </TableHeadCell>
            <TableHeadCell scope="col" class="py-2">
              {labels.date}
            </TableHeadCell>
            <TableHeadCell scope="col" class="py-2">
              {labels.items}
            </TableHeadCell>
            <TableHeadCell scope="col" class="py-2">
              {labels.total}
            </TableHeadCell>
            <TableHeadCell scope="col" class="py-2">
              {labels.status}
            </TableHeadCell>
          </TableRow>
        </TableHead>
        <TableBody>
          <For each={orders ?? []}>{(o) => (
            <TableRow class="border-t border-border" data-slot="item">
              <TableCell class={cn("font-semibold", (((density as string) === "compact") ? "py-2" : "py-4"))}>
                {o.number}
              </TableCell>
              <TableCell>
                {o.date}
              </TableCell>
              <TableCell>
                {tpl(labels.itemsCount, o.items)}
              </TableCell>
              <TableCell>
                {fmtMoney(o.total, o.currency)}
              </TableCell>
              <TableCell>
                <Pill
                  tone={
                    o.status === "paid" ? "green"
                    : o.status === "shipped" ? "blue"
                    : o.status === "pending" ? "amber"
                    : "gray"
                  }
                >
                  {at(statuses, o.status)}
                </Pill>
              </TableCell>
            </TableRow>
          )}</For>
        </TableBody>
      </Table>
    </Box>
  );
}

Solid registry item (JSON)

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-cdn
npx ui8kit add order-rows
blocks/order-rows.templ
// 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-rows.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"
)

// OrderRowsProps are the props of OrderRows; the values are the JSON shapes of the TypeScript props.
type OrderRowsProps struct {
	Orders any `json:"orders"`
	Statuses any `json:"statuses"`
	Labels any `json:"labels"`
	Density any `json:"density"`
}

// The orders as a table (the table layout of OrderTable): number, date, items, total and a status pill.
templ OrderRows(p OrderRowsProps) {
	{{ vOrders := p.Orders }}
	{{ vStatuses := p.Statuses }}
	{{ vLabels := p.Labels }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "w-full overflow-x-auto", Attrs: uiutils.Attrs("data-slot", "order-rows")}}) {
		@compose.Table(compose.TableProps{BoxProps: box.BoxProps{Class: "w-full text-left text-sm", Attrs: uiutils.Attrs("data-slot", "order-table")}}) {
			@compose.TableCaption(compose.TableCaptionProps{BoxProps: box.BoxProps{Class: "sr-only"}}) {
				{ uiutils.Text(uiutils.Get(vLabels, "caption")) }
			}
			@compose.TableHead(compose.TableHeadProps{BoxProps: box.BoxProps{}}) {
				@compose.TableRow(compose.TableRowProps{BoxProps: box.BoxProps{}}) {
					@compose.TableHeadCell(compose.TableHeadCellProps{BoxProps: box.BoxProps{Class: "py-2", Attrs: uiutils.Attrs("scope", "col")}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "number")) }
					}
					@compose.TableHeadCell(compose.TableHeadCellProps{BoxProps: box.BoxProps{Class: "py-2", Attrs: uiutils.Attrs("scope", "col")}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "date")) }
					}
					@compose.TableHeadCell(compose.TableHeadCellProps{BoxProps: box.BoxProps{Class: "py-2", Attrs: uiutils.Attrs("scope", "col")}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "items")) }
					}
					@compose.TableHeadCell(compose.TableHeadCellProps{BoxProps: box.BoxProps{Class: "py-2", Attrs: uiutils.Attrs("scope", "col")}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "total")) }
					}
					@compose.TableHeadCell(compose.TableHeadCellProps{BoxProps: box.BoxProps{Class: "py-2", Attrs: uiutils.Attrs("scope", "col")}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "status")) }
					}
				}
			}
			@compose.TableBody(compose.TableBodyProps{BoxProps: box.BoxProps{}}) {
				for _, vO := range uiutils.L(vOrders) {
					@compose.TableRow(compose.TableRowProps{BoxProps: box.BoxProps{Class: "border-t border-border", Attrs: uiutils.Attrs("data-slot", "item")}}) {
						@compose.TableCell(compose.TableCellProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("font-semibold", uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "py-2", "py-4")))}}) {
							{ uiutils.Text(uiutils.Get(vO, "number")) }
						}
						@compose.TableCell(compose.TableCellProps{BoxProps: box.BoxProps{}}) {
							{ uiutils.Text(uiutils.Get(vO, "date")) }
						}
						@compose.TableCell(compose.TableCellProps{BoxProps: box.BoxProps{}}) {
							{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "itemsCount"), uiutils.Get(vO, "items"))) }
						}
						@compose.TableCell(compose.TableCellProps{BoxProps: box.BoxProps{}}) {
							{ uiutils.Text(uiutils.Money(uiutils.Get(vO, "total"), uiutils.Get(vO, "currency"))) }
						}
						@compose.TableCell(compose.TableCellProps{BoxProps: box.BoxProps{}}) {
							@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"))) }
							}
						}
					}
				}
			}
		}
	}
}

templ registry item (JSON)

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-cdn
npx ui8kit add order-rows
blocks/order-rows.html.twig
{#- 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-rows.json
    The orders as a table (the table layout of OrderTable): number, date, items, total and a status pill.
    Props (p): orders, statuses, labels, density. -#}
{%- set v_orders = (p.orders ?? null) -%}
{%- set v_statuses = (p.statuses ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set c_18 -%}
  {%- set c_17 -%}
    {%- set c_1 -%}
      {{ og_text(og_get(v_labels, ['caption'])) }}
    {%- endset -%}
    {{ include('compose/TableCaption.html.twig', {'class': 'sr-only', 'children': c_1}, with_context = false) }}
    {%- set c_8 -%}
      {%- set c_7 -%}
        {%- set c_2 -%}
          {{ og_text(og_get(v_labels, ['number'])) }}
        {%- endset -%}
        {{ include('compose/TableHeadCell.html.twig', {'class': 'py-2', 'attrs': og_attrs(['scope', 'col']), 'children': c_2}, with_context = false) }}
        {%- set c_3 -%}
          {{ og_text(og_get(v_labels, ['date'])) }}
        {%- endset -%}
        {{ include('compose/TableHeadCell.html.twig', {'class': 'py-2', 'attrs': og_attrs(['scope', 'col']), 'children': c_3}, with_context = false) }}
        {%- set c_4 -%}
          {{ og_text(og_get(v_labels, ['items'])) }}
        {%- endset -%}
        {{ include('compose/TableHeadCell.html.twig', {'class': 'py-2', 'attrs': og_attrs(['scope', 'col']), 'children': c_4}, with_context = false) }}
        {%- set c_5 -%}
          {{ og_text(og_get(v_labels, ['total'])) }}
        {%- endset -%}
        {{ include('compose/TableHeadCell.html.twig', {'class': 'py-2', 'attrs': og_attrs(['scope', 'col']), 'children': c_5}, with_context = false) }}
        {%- set c_6 -%}
          {{ og_text(og_get(v_labels, ['status'])) }}
        {%- endset -%}
        {{ include('compose/TableHeadCell.html.twig', {'class': 'py-2', 'attrs': og_attrs(['scope', 'col']), 'children': c_6}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/TableRow.html.twig', {'children': c_7}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/TableHead.html.twig', {'children': c_8}, with_context = false) }}
    {%- set c_16 -%}
      {%- for v_o in og_l(v_orders) %}
        {%- set c_15 -%}
          {%- set c_9 -%}
            {{ og_text(og_get(v_o, ['number'])) }}
          {%- endset -%}
          {{ include('compose/TableCell.html.twig', {'class': og_s(og_cnv(['font-semibold', (og_t(og_eq(v_density, 'compact')) ? 'py-2' : 'py-4')])), 'children': c_9}, with_context = false) }}
          {%- set c_10 -%}
            {{ og_text(og_get(v_o, ['date'])) }}
          {%- endset -%}
          {{ include('compose/TableCell.html.twig', {'children': c_10}, with_context = false) }}
          {%- set c_11 -%}
            {{ og_text(og_tpl(og_get(v_labels, ['itemsCount']), [og_get(v_o, ['items'])])) }}
          {%- endset -%}
          {{ include('compose/TableCell.html.twig', {'children': c_11}, with_context = false) }}
          {%- set c_12 -%}
            {{ og_text(og_money(og_get(v_o, ['total']), og_get(v_o, ['currency']))) }}
          {%- endset -%}
          {{ include('compose/TableCell.html.twig', {'children': c_12}, with_context = false) }}
          {%- set c_14 -%}
            {%- set c_13 -%}
              {{ 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_13)}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/TableCell.html.twig', {'children': c_14}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/TableRow.html.twig', {'class': 'border-t border-border', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_15}, with_context = false) }}
      {%- endfor %}
    {%- endset -%}
    {{ include('compose/TableBody.html.twig', {'children': c_16}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Table.html.twig', {'class': 'w-full text-left text-sm', 'attrs': og_attrs(['data-slot', 'order-table']), 'children': c_17}, with_context = false) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'w-full overflow-x-auto', 'attrs': og_attrs(['data-slot', 'order-rows']), 'children': c_18}, with_context = false) }}

Twig registry item (JSON)

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-cdn
npx ui8kit add order-rows
blocks/order-rows.latte
{* 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-rows.json
    The orders as a table (the table layout of OrderTable): number, date, items, total and a status pill.
    Props (p): orders, statuses, labels, density. *}
{var $v_orders = ($p['orders'] ?? null)}
{var $v_statuses = ($p['statuses'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_density = ($p['density'] ?? 'default')}
{capture $c_18}
  {capture $c_17}
    {capture $c_1}
      {=og_text(og_get($v_labels, ['caption']))}
    {/capture}
    {=og_include('compose/TableCaption.latte', ['class' => 'sr-only', 'children' => (string) $c_1])|noescape}
    {capture $c_8}
      {capture $c_7}
        {capture $c_2}
          {=og_text(og_get($v_labels, ['number']))}
        {/capture}
        {=og_include('compose/TableHeadCell.latte', ['class' => 'py-2', 'attrs' => og_attrs(['scope', 'col']), 'children' => (string) $c_2])|noescape}
        {capture $c_3}
          {=og_text(og_get($v_labels, ['date']))}
        {/capture}
        {=og_include('compose/TableHeadCell.latte', ['class' => 'py-2', 'attrs' => og_attrs(['scope', 'col']), 'children' => (string) $c_3])|noescape}
        {capture $c_4}
          {=og_text(og_get($v_labels, ['items']))}
        {/capture}
        {=og_include('compose/TableHeadCell.latte', ['class' => 'py-2', 'attrs' => og_attrs(['scope', 'col']), 'children' => (string) $c_4])|noescape}
        {capture $c_5}
          {=og_text(og_get($v_labels, ['total']))}
        {/capture}
        {=og_include('compose/TableHeadCell.latte', ['class' => 'py-2', 'attrs' => og_attrs(['scope', 'col']), 'children' => (string) $c_5])|noescape}
        {capture $c_6}
          {=og_text(og_get($v_labels, ['status']))}
        {/capture}
        {=og_include('compose/TableHeadCell.latte', ['class' => 'py-2', 'attrs' => og_attrs(['scope', 'col']), 'children' => (string) $c_6])|noescape}
      {/capture}
      {=og_include('compose/TableRow.latte', ['children' => (string) $c_7])|noescape}
    {/capture}
    {=og_include('compose/TableHead.latte', ['children' => (string) $c_8])|noescape}
    {capture $c_16}
      {foreach og_l($v_orders) as $v_o}
        {capture $c_15}
          {capture $c_9}
            {=og_text(og_get($v_o, ['number']))}
          {/capture}
          {=og_include('compose/TableCell.latte', ['class' => og_s(og_cnv(['font-semibold', (og_t(og_eq($v_density, 'compact')) ? 'py-2' : 'py-4')])), 'children' => (string) $c_9])|noescape}
          {capture $c_10}
            {=og_text(og_get($v_o, ['date']))}
          {/capture}
          {=og_include('compose/TableCell.latte', ['children' => (string) $c_10])|noescape}
          {capture $c_11}
            {=og_text(og_tpl(og_get($v_labels, ['itemsCount']), [og_get($v_o, ['items'])]))}
          {/capture}
          {=og_include('compose/TableCell.latte', ['children' => (string) $c_11])|noescape}
          {capture $c_12}
            {=og_text(og_money(og_get($v_o, ['total']), og_get($v_o, ['currency'])))}
          {/capture}
          {=og_include('compose/TableCell.latte', ['children' => (string) $c_12])|noescape}
          {capture $c_14}
            {capture $c_13}
              {=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_13)])|noescape}
          {/capture}
          {=og_include('compose/TableCell.latte', ['children' => (string) $c_14])|noescape}
        {/capture}
        {=og_include('compose/TableRow.latte', ['class' => 'border-t border-border', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_15])|noescape}
      {/foreach}
    {/capture}
    {=og_include('compose/TableBody.latte', ['children' => (string) $c_16])|noescape}
  {/capture}
  {=og_include('compose/Table.latte', ['class' => 'w-full text-left text-sm', 'attrs' => og_attrs(['data-slot', 'order-table']), 'children' => (string) $c_17])|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'w-full overflow-x-auto', 'attrs' => og_attrs(['data-slot', 'order-rows']), 'children' => (string) $c_18])|noescape}

Latte registry item (JSON)

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-cdn
npx ui8kit add order-rows
blocks/order-rows.html.j2
{#- 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-rows.json
    The orders as a table (the table layout of OrderTable): number, date, items, total and a status pill.
    Props (p): orders, statuses, labels, density. -#}
{%- set v_orders = og_def(p['orders'], none) -%}
{%- set v_statuses = og_def(p['statuses'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set c_18 -%}
  {%- set c_17 -%}
    {%- set c_1 -%}
      {{ og_text(og_get(v_labels, ['caption'])) }}
    {%- endset -%}
    {{ og_include('compose/table-caption.html.j2', {'p': {'Class': 'sr-only'}, 'children': c_1}) }}
    {%- set c_8 -%}
      {%- set c_7 -%}
        {%- set c_2 -%}
          {{ og_text(og_get(v_labels, ['number'])) }}
        {%- endset -%}
        {{ og_include('compose/table-head-cell.html.j2', {'p': {'Class': 'py-2', 'Attrs': og_attrs(['scope', 'col'])}, 'children': c_2}) }}
        {%- set c_3 -%}
          {{ og_text(og_get(v_labels, ['date'])) }}
        {%- endset -%}
        {{ og_include('compose/table-head-cell.html.j2', {'p': {'Class': 'py-2', 'Attrs': og_attrs(['scope', 'col'])}, 'children': c_3}) }}
        {%- set c_4 -%}
          {{ og_text(og_get(v_labels, ['items'])) }}
        {%- endset -%}
        {{ og_include('compose/table-head-cell.html.j2', {'p': {'Class': 'py-2', 'Attrs': og_attrs(['scope', 'col'])}, 'children': c_4}) }}
        {%- set c_5 -%}
          {{ og_text(og_get(v_labels, ['total'])) }}
        {%- endset -%}
        {{ og_include('compose/table-head-cell.html.j2', {'p': {'Class': 'py-2', 'Attrs': og_attrs(['scope', 'col'])}, 'children': c_5}) }}
        {%- set c_6 -%}
          {{ og_text(og_get(v_labels, ['status'])) }}
        {%- endset -%}
        {{ og_include('compose/table-head-cell.html.j2', {'p': {'Class': 'py-2', 'Attrs': og_attrs(['scope', 'col'])}, 'children': c_6}) }}
      {%- endset -%}
      {{ og_include('compose/table-row.html.j2', {'p': {}, 'children': c_7}) }}
    {%- endset -%}
    {{ og_include('compose/table-head.html.j2', {'p': {}, 'children': c_8}) }}
    {%- set c_16 -%}
      {%- for v_o in og_l(v_orders) %}
        {%- set c_15 -%}
          {%- set c_9 -%}
            {{ og_text(og_get(v_o, ['number'])) }}
          {%- endset -%}
          {{ og_include('compose/table-cell.html.j2', {'p': {'Class': og_s(og_cnv(['font-semibold', ('py-2' if og_t(og_eq(v_density, 'compact')) else 'py-4')]))}, 'children': c_9}) }}
          {%- set c_10 -%}
            {{ og_text(og_get(v_o, ['date'])) }}
          {%- endset -%}
          {{ og_include('compose/table-cell.html.j2', {'p': {}, 'children': c_10}) }}
          {%- set c_11 -%}
            {{ og_text(og_tpl(og_get(v_labels, ['itemsCount']), [og_get(v_o, ['items'])])) }}
          {%- endset -%}
          {{ og_include('compose/table-cell.html.j2', {'p': {}, 'children': c_11}) }}
          {%- set c_12 -%}
            {{ og_text(og_money(og_get(v_o, ['total']), og_get(v_o, ['currency']))) }}
          {%- endset -%}
          {{ og_include('compose/table-cell.html.j2', {'p': {}, 'children': c_12}) }}
          {%- set c_14 -%}
            {%- set c_13 -%}
              {{ 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_13)}) }}
          {%- endset -%}
          {{ og_include('compose/table-cell.html.j2', {'p': {}, 'children': c_14}) }}
        {%- endset -%}
        {{ og_include('compose/table-row.html.j2', {'p': {'Class': 'border-t border-border', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_15}) }}
      {%- endfor %}
    {%- endset -%}
    {{ og_include('compose/table-body.html.j2', {'p': {}, 'children': c_16}) }}
  {%- endset -%}
  {{ og_include('compose/table.html.j2', {'p': {'Class': 'w-full text-left text-sm', 'Attrs': og_attrs(['data-slot', 'order-table'])}, 'children': c_17}) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'w-full overflow-x-auto', 'Attrs': og_attrs(['data-slot', 'order-rows'])}, 'children': c_18}) }}

Jinja2 registry item (JSON)

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 orders as a table (the table layout of OrderTable): number, date, items, total and a status pill.

Props of OrderRows
PropTypeDefault Description
orders (required)Order[]-
statuses (required)Record<string, string>-word by order status
labels (required)OrderLabels-
density "default" | "compact""default"

Used in