Zone Table
Delivery zones and their prices as a table or as cards.
Install
npx ui8kit add zone-tablePulls in: badge, compose, empty-state, grid, inline, kit-box, kit-text, list, list-item, section-frame, stack, text, title, utils, zone-rows
Preview
Delivery zones and prices
The price depends on the zone of your address. Large orders ship free.
| Zone | Delivery | Free from | Time |
|---|---|---|---|
Central zone Old Town, Riverside, Market Square | $12 | $75 | 90 minutes |
Inner suburbs Northfield, Elm Park, Harbour | $15 | $100 | 2 hours |
Outer towns Westbrook, Hillside, Lakeview | $19 | $150 | Same day |
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 zone-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. -->
<!--
Delivery zones and their prices as a table or as cards: the zone and its areas, the price, the order that
ships free, the minimum order, the time and an express badge. Axes: layout (table, cards), tone, density.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Zone, ZoneLabels } from "./zone-table.types";
export type ZoneTableProps = {
id: string;
title: string;
lead?: string;
zones: Zone[];
empty?: string;
labels: ZoneLabels;
layout?: "table" | "cards";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Badge from "../compose/Badge.svelte";
import Grid from "../compose/Grid.svelte";
import Inline from "../compose/Inline.svelte";
import List from "../compose/List.svelte";
import ListItem from "../compose/ListItem.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import Title from "../compose/Title.svelte";
import EmptyState from "../components/empty-state.svelte";
import SectionFrame from "../components/section-frame.svelte";
import ZoneRows from "../components/zone-rows.svelte";
import { fmtMoney } from "../utils";
let {
id,
title,
lead = "",
zones,
empty = "",
labels,
layout = "table",
tone = "default",
density = "default",
landmarkLabel,
}: ZoneTableProps = $props();
</script>
<SectionFrame id={id} title={title} lead={lead} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{#if ((zones?.length ?? 0) === 0)}
<EmptyState icon="map" title={empty} />
{:else if ((layout as string) === "table")}
<ZoneRows zones={zones} labels={labels} />
{:else}
<Grid cols="1-3" class="gap-4" data-slot="items">
{#each zones as z (z.id)}
<Stack gap="4" class="rounded bg-card inset-ring inset-ring-border p-6" data-slot="item">
<Stack gap="2">
<Title as={3} size="lg" weight="bold">
{z.name}
</Title>
<Text size="sm" class="text-muted-foreground">
{z.area}
</Text>
</Stack>
<Text size="3xl" weight="bold">
{fmtMoney(z.price, z.currency)}
</Text>
<List tag="ul" class="flex flex-col gap-2 border-t border-border pt-4">
<ListItem class="flex items-center justify-between gap-4 text-sm">
<Inline class="text-muted-foreground">
{labels.freeFrom}
</Inline>
<Inline class="font-medium">
{fmtMoney(z.freeFrom, z.currency)}
</Inline>
</ListItem>
<ListItem class="flex items-center justify-between gap-4 text-sm">
<Inline class="text-muted-foreground">
{labels.minOrder}
</Inline>
<Inline class="font-medium">
{fmtMoney(z.minOrder, z.currency)}
</Inline>
</ListItem>
<ListItem class="flex items-center justify-between gap-4 text-sm">
<Inline class="text-muted-foreground">
{labels.time}
</Inline>
<Inline class="font-medium">
{z.time}
</Inline>
</ListItem>
</List>
{#if z.express}
<Badge variant="secondary" size="default" class="w-fit">
{z.express}
</Badge>
{/if}
</Stack>
{/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 Zone = {
id: string;
name: string;
area: string;
price: number;
freeFrom: number;
minOrder: number;
time: string;
express: string;
currency: string;
};
export type ZoneLabels = {
caption: string;
zone: string;
price: string;
freeFrom: string;
minOrder: string;
time: string;
express: 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 zone-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.
/**
* Delivery zones and their prices as a table or as cards: the zone and its areas, the price, the order that
* ships free, the minimum order, the time and an express badge. Axes: layout (table, cards), tone, density.
*/
import { type ReactNode } from "react";
import { Badge, Grid, Inline, List, ListItem, Stack, Text, Title } from "../compose";
import { EmptyState } from "../components/empty-state";
import { SectionFrame } from "../components/section-frame";
import { ZoneRows } from "../components/zone-rows";
import { fmtMoney } from "../utils";
import type { Zone, ZoneLabels } from "./zone-table.types";
export type ZoneTableProps = {
id: string;
title: string;
lead?: string;
zones: Zone[];
empty?: string;
labels: ZoneLabels;
layout?: "table" | "cards";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function ZoneTable({
id,
title,
lead = "",
zones,
empty = "",
labels,
layout = "table",
tone = "default",
density = "default",
landmarkLabel,
}: ZoneTableProps) {
return (
<SectionFrame id={id} title={title} lead={lead} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{((zones?.length ?? 0) === 0) ? (
<EmptyState icon="map" title={empty} />
) : ((layout as string) === "table") ? (
<ZoneRows zones={zones} labels={labels} />
) : (
<Grid cols="1-3" className="gap-4" data-slot="items">
{(zones ?? []).map((z) => (
<Stack key={z.id} gap="4" className="rounded bg-card inset-ring inset-ring-border p-6" data-slot="item">
<Stack gap="2">
<Title as={3} size="lg" weight="bold">
{z.name}
</Title>
<Text size="sm" className="text-muted-foreground">
{z.area}
</Text>
</Stack>
<Text size="3xl" weight="bold">
{fmtMoney(z.price, z.currency)}
</Text>
<List tag="ul" className="flex flex-col gap-2 border-t border-border pt-4">
<ListItem className="flex items-center justify-between gap-4 text-sm">
<Inline className="text-muted-foreground">
{labels.freeFrom}
</Inline>
<Inline className="font-medium">
{fmtMoney(z.freeFrom, z.currency)}
</Inline>
</ListItem>
<ListItem className="flex items-center justify-between gap-4 text-sm">
<Inline className="text-muted-foreground">
{labels.minOrder}
</Inline>
<Inline className="font-medium">
{fmtMoney(z.minOrder, z.currency)}
</Inline>
</ListItem>
<ListItem className="flex items-center justify-between gap-4 text-sm">
<Inline className="text-muted-foreground">
{labels.time}
</Inline>
<Inline className="font-medium">
{z.time}
</Inline>
</ListItem>
</List>
{z.express ? (
<Badge variant="secondary" size="default" className="w-fit">
{z.express}
</Badge>
) : null}
</Stack>
))}
</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 Zone = {
id: string;
name: string;
area: string;
price: number;
freeFrom: number;
minOrder: number;
time: string;
express: string;
currency: string;
};
export type ZoneLabels = {
caption: string;
zone: string;
price: string;
freeFrom: string;
minOrder: string;
time: string;
express: 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 zone-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 Zone = {
id: string;
name: string;
area: string;
price: number;
freeFrom: number;
minOrder: number;
time: string;
express: string;
currency: string;
};
export type ZoneLabels = {
caption: string;
zone: string;
price: string;
freeFrom: string;
minOrder: string;
time: string;
express: 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. -->
<!--
Delivery zones and their prices as a table or as cards: the zone and its areas, the price, the order that
ships free, the minimum order, the time and an express badge. Axes: layout (table, cards), tone, density.
-->
<script lang="ts">
import type { Zone, ZoneLabels } from "./zone-table.types";
export type ZoneTableProps = {
id: string;
title: string;
lead?: string;
zones: Zone[];
empty?: string;
labels: ZoneLabels;
layout?: "table" | "cards";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Badge from "../compose/Badge.vue";
import Grid from "../compose/Grid.vue";
import Inline from "../compose/Inline.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import EmptyState from "../components/empty-state.vue";
import SectionFrame from "../components/section-frame.vue";
import ZoneRows from "../components/zone-rows.vue";
import { fmtMoney } from "../utils";
const {
id,
title,
lead = "",
zones,
empty = "",
labels,
layout = "table",
tone = "default",
density = "default",
landmarkLabel,
} = defineProps<ZoneTableProps>();
</script>
<template>
<SectionFrame
:id="id"
:title="title"
:lead="lead"
:tone="tone"
:density="density"
:landmarkLabel="landmarkLabel"
>
<EmptyState v-if="((zones?.length ?? 0) === 0)" icon="map" :title="empty" />
<ZoneRows v-else-if="((layout as string) === 'table')" :zones="zones" :labels="labels" />
<Grid v-else cols="1-3" class="gap-4" data-slot="items">
<Stack
v-for="z in zones"
:key="z.id"
gap="4"
class="rounded bg-card inset-ring inset-ring-border p-6"
data-slot="item"
>
<Stack gap="2">
<Title :as="3" size="lg" weight="bold">
{{ z.name }}
</Title>
<Text size="sm" class="text-muted-foreground">
{{ z.area }}
</Text>
</Stack>
<Text size="3xl" weight="bold">
{{ fmtMoney(z.price, z.currency) }}
</Text>
<List tag="ul" class="flex flex-col gap-2 border-t border-border pt-4">
<ListItem class="flex items-center justify-between gap-4 text-sm">
<Inline class="text-muted-foreground">
{{ labels.freeFrom }}
</Inline>
<Inline class="font-medium">
{{ fmtMoney(z.freeFrom, z.currency) }}
</Inline>
</ListItem>
<ListItem class="flex items-center justify-between gap-4 text-sm">
<Inline class="text-muted-foreground">
{{ labels.minOrder }}
</Inline>
<Inline class="font-medium">
{{ fmtMoney(z.minOrder, z.currency) }}
</Inline>
</ListItem>
<ListItem class="flex items-center justify-between gap-4 text-sm">
<Inline class="text-muted-foreground">
{{ labels.time }}
</Inline>
<Inline class="font-medium">
{{ z.time }}
</Inline>
</ListItem>
</List>
<Badge v-if="z.express" variant="secondary" size="default" class="w-fit">
{{ z.express }}
</Badge>
</Stack>
</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 zone-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.
/**
* Delivery zones and their prices as a table or as cards: the zone and its areas, the price, the order that
* ships free, the minimum order, the time and an express badge. Axes: layout (table, cards), tone, density.
*/
import { For, type JSX } from "solid-js";
import { Badge, Grid, Inline, List, ListItem, Stack, Text, Title } from "../compose";
import { EmptyState } from "../components/empty-state";
import { SectionFrame } from "../components/section-frame";
import { ZoneRows } from "../components/zone-rows";
import { fmtMoney } from "../utils";
import type { Zone, ZoneLabels } from "./zone-table.types";
export type ZoneTableProps = {
id: string;
title: string;
lead?: string;
zones: Zone[];
empty?: string;
labels: ZoneLabels;
layout?: "table" | "cards";
tone?: "default" | "muted";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function ZoneTable({
id,
title,
lead = "",
zones,
empty = "",
labels,
layout = "table",
tone = "default",
density = "default",
landmarkLabel,
}: ZoneTableProps) {
return (
<SectionFrame id={id} title={title} lead={lead} tone={tone} density={density} landmarkLabel={landmarkLabel}>
{((zones?.length ?? 0) === 0) ? (
<EmptyState icon="map" title={empty} />
) : ((layout as string) === "table") ? (
<ZoneRows zones={zones} labels={labels} />
) : (
<Grid cols="1-3" class="gap-4" data-slot="items">
<For each={zones ?? []}>{(z) => (
<Stack gap="4" class="rounded bg-card inset-ring inset-ring-border p-6" data-slot="item">
<Stack gap="2">
<Title as={3} size="lg" weight="bold">
{z.name}
</Title>
<Text size="sm" class="text-muted-foreground">
{z.area}
</Text>
</Stack>
<Text size="3xl" weight="bold">
{fmtMoney(z.price, z.currency)}
</Text>
<List tag="ul" class="flex flex-col gap-2 border-t border-border pt-4">
<ListItem class="flex items-center justify-between gap-4 text-sm">
<Inline class="text-muted-foreground">
{labels.freeFrom}
</Inline>
<Inline class="font-medium">
{fmtMoney(z.freeFrom, z.currency)}
</Inline>
</ListItem>
<ListItem class="flex items-center justify-between gap-4 text-sm">
<Inline class="text-muted-foreground">
{labels.minOrder}
</Inline>
<Inline class="font-medium">
{fmtMoney(z.minOrder, z.currency)}
</Inline>
</ListItem>
<ListItem class="flex items-center justify-between gap-4 text-sm">
<Inline class="text-muted-foreground">
{labels.time}
</Inline>
<Inline class="font-medium">
{z.time}
</Inline>
</ListItem>
</List>
{z.express ? (
<Badge variant="secondary" size="default" class="w-fit">
{z.express}
</Badge>
) : null}
</Stack>
)}</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 Zone = {
id: string;
name: string;
area: string;
price: number;
freeFrom: number;
minOrder: number;
time: string;
express: string;
currency: string;
};
export type ZoneLabels = {
caption: string;
zone: string;
price: string;
freeFrom: string;
minOrder: string;
time: string;
express: 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 zone-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/zone-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"
)
// ZoneTableProps are the props of ZoneTable; the values are the JSON shapes of the TypeScript props.
type ZoneTableProps struct {
Id any `json:"id"`
Title any `json:"title"`
Lead any `json:"lead"`
Zones any `json:"zones"`
Empty any `json:"empty"`
Labels any `json:"labels"`
Layout any `json:"layout"`
Tone any `json:"tone"`
Density any `json:"density"`
LandmarkLabel any `json:"landmarkLabel"`
}
// Delivery zones and their prices as a table or as cards: the zone and its areas, the price, the order that ships free, the minimum order, the time and an express badge. Axes: layout (table, cards), tone, density.
templ ZoneTable(p ZoneTableProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vLead := uiutils.Def(p.Lead, "") }}
{{ vZones := p.Zones }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vLabels := p.Labels }}
{{ vLayout := uiutils.Def(p.Layout, "table") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vDensity := uiutils.Def(p.Density, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vLead, Tone: vTone, Density: vDensity, LandmarkLabel: vLandmarkLabel}) {
if uiutils.Eq(uiutils.Len(vZones), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "map", Title: vEmpty})
} else if uiutils.Eq(vLayout, "table") {
@ZoneRows(ZoneRowsProps{Zones: vZones, Labels: vLabels})
} else {
@compose.Grid(compose.GridProps{Cols: "1-3", BoxProps: box.BoxProps{Class: "gap-4", Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vZ := range uiutils.L(vZones) {
@compose.Stack(compose.StackProps{Gap: "4", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-6", Attrs: uiutils.Attrs("data-slot", "item")}}) {
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{}}) {
@compose.Title(compose.TitleProps{As: "3", Size: "lg", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vZ, "name")) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vZ, "area")) }
}
}
@compose.Text(compose.TextProps{Size: "3xl", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Money(uiutils.Get(vZ, "price"), uiutils.Get(vZ, "currency"))) }
}
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ul", Class: "flex flex-col gap-2 border-t border-border pt-4"}}) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex items-center justify-between gap-4 text-sm"}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vLabels, "freeFrom")) }
}
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "font-medium"}}) {
{ uiutils.Text(uiutils.Money(uiutils.Get(vZ, "freeFrom"), uiutils.Get(vZ, "currency"))) }
}
}
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex items-center justify-between gap-4 text-sm"}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vLabels, "minOrder")) }
}
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "font-medium"}}) {
{ uiutils.Text(uiutils.Money(uiutils.Get(vZ, "minOrder"), uiutils.Get(vZ, "currency"))) }
}
}
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex items-center justify-between gap-4 text-sm"}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vLabels, "time")) }
}
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "font-medium"}}) {
{ uiutils.Text(uiutils.Get(vZ, "time")) }
}
}
}
if uiutils.T(uiutils.Get(vZ, "express")) {
@compose.Badge(compose.BadgeProps{Variant: "secondary", Size: "default", TextProps: text.TextProps{Class: "w-fit"}}) {
{ uiutils.Text(uiutils.Get(vZ, "express")) }
}
}
}
}
}
}
}
}
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 zone-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/zone-table.json
Delivery zones and their prices as a table or as cards: the zone and its areas, the price, the order that ships free, the minimum order, the time and an express badge. Axes: layout (table, cards), tone, density.
Props (p): id, title, lead, zones, empty, labels, layout, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_lead = (p.lead ?? '') -%}
{%- set v_zones = (p.zones ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'table') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_18 -%}
{%- if og_t(og_eq(og_len(v_zones), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'map', 'title': v_empty}}, with_context = false) }}
{%- elseif og_t(og_eq(v_layout, 'table')) %}
{{ include('blocks/zone-rows.html.twig', {'p': {'zones': v_zones, 'labels': v_labels}}, with_context = false) }}
{%- else %}
{%- set c_17 -%}
{%- for v_z in og_l(v_zones) %}
{%- set c_16 -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_z, ['name'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'lg', 'weight': 'bold', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_get(v_z, ['area'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'children': c_3}, with_context = false) }}
{%- set c_4 -%}
{{ og_text(og_money(og_get(v_z, ['price']), og_get(v_z, ['currency']))) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': '3xl', 'weight': 'bold', 'children': c_4}, with_context = false) }}
{%- set c_14 -%}
{%- set c_7 -%}
{%- set c_5 -%}
{{ og_text(og_get(v_labels, ['freeFrom'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-muted-foreground', 'children': c_5}, with_context = false) }}
{%- set c_6 -%}
{{ og_text(og_money(og_get(v_z, ['freeFrom']), og_get(v_z, ['currency']))) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'font-medium', 'children': c_6}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': 'flex items-center justify-between gap-4 text-sm', 'children': c_7}, with_context = false) }}
{%- set c_10 -%}
{%- set c_8 -%}
{{ og_text(og_get(v_labels, ['minOrder'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-muted-foreground', 'children': c_8}, with_context = false) }}
{%- set c_9 -%}
{{ og_text(og_money(og_get(v_z, ['minOrder']), og_get(v_z, ['currency']))) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'font-medium', 'children': c_9}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': 'flex items-center justify-between gap-4 text-sm', 'children': c_10}, with_context = false) }}
{%- set c_13 -%}
{%- set c_11 -%}
{{ og_text(og_get(v_labels, ['time'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-muted-foreground', 'children': c_11}, with_context = false) }}
{%- set c_12 -%}
{{ og_text(og_get(v_z, ['time'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'font-medium', 'children': c_12}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': 'flex items-center justify-between gap-4 text-sm', 'children': c_13}, with_context = false) }}
{%- endset -%}
{{ include('compose/List.html.twig', {'tag': 'ul', 'class': 'flex flex-col gap-2 border-t border-border pt-4', 'children': c_14}, with_context = false) }}
{%- if og_t(og_get(v_z, ['express'])) %}
{%- set c_15 -%}
{{ og_text(og_get(v_z, ['express'])) }}
{%- endset -%}
{{ include('compose/Badge.html.twig', {'variant': 'secondary', 'size': 'default', 'class': 'w-fit', 'children': c_15}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'class': 'rounded bg-card inset-ring inset-ring-border p-6', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_16}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': '1-3', 'class': 'gap-4', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_17}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_18)}, 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 zone-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/zone-table.json
Delivery zones and their prices as a table or as cards: the zone and its areas, the price, the order that ships free, the minimum order, the time and an express badge. Axes: layout (table, cards), tone, density.
Props (p): id, title, lead, zones, empty, labels, layout, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_lead = ($p['lead'] ?? '')}
{var $v_zones = ($p['zones'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'table')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_18}
{if og_t(og_eq(og_len($v_zones), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'map', 'title' => $v_empty]])|noescape}
{elseif og_t(og_eq($v_layout, 'table'))}
{=og_include('blocks/zone-rows.latte', ['p' => ['zones' => $v_zones, 'labels' => $v_labels]])|noescape}
{else}
{capture $c_17}
{foreach og_l($v_zones) as $v_z}
{capture $c_16}
{capture $c_3}
{capture $c_1}
{=og_text(og_get($v_z, ['name']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'lg', 'weight' => 'bold', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_text(og_get($v_z, ['area']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'children' => (string) $c_3])|noescape}
{capture $c_4}
{=og_text(og_money(og_get($v_z, ['price']), og_get($v_z, ['currency'])))}
{/capture}
{=og_include('compose/Text.latte', ['size' => '3xl', 'weight' => 'bold', 'children' => (string) $c_4])|noescape}
{capture $c_14}
{capture $c_7}
{capture $c_5}
{=og_text(og_get($v_labels, ['freeFrom']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-muted-foreground', 'children' => (string) $c_5])|noescape}
{capture $c_6}
{=og_text(og_money(og_get($v_z, ['freeFrom']), og_get($v_z, ['currency'])))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'font-medium', 'children' => (string) $c_6])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => 'flex items-center justify-between gap-4 text-sm', 'children' => (string) $c_7])|noescape}
{capture $c_10}
{capture $c_8}
{=og_text(og_get($v_labels, ['minOrder']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-muted-foreground', 'children' => (string) $c_8])|noescape}
{capture $c_9}
{=og_text(og_money(og_get($v_z, ['minOrder']), og_get($v_z, ['currency'])))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'font-medium', 'children' => (string) $c_9])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => 'flex items-center justify-between gap-4 text-sm', 'children' => (string) $c_10])|noescape}
{capture $c_13}
{capture $c_11}
{=og_text(og_get($v_labels, ['time']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-muted-foreground', 'children' => (string) $c_11])|noescape}
{capture $c_12}
{=og_text(og_get($v_z, ['time']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'font-medium', 'children' => (string) $c_12])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => 'flex items-center justify-between gap-4 text-sm', 'children' => (string) $c_13])|noescape}
{/capture}
{=og_include('compose/List.latte', ['tag' => 'ul', 'class' => 'flex flex-col gap-2 border-t border-border pt-4', 'children' => (string) $c_14])|noescape}
{if og_t(og_get($v_z, ['express']))}
{capture $c_15}
{=og_text(og_get($v_z, ['express']))}
{/capture}
{=og_include('compose/Badge.latte', ['variant' => 'secondary', 'size' => 'default', 'class' => 'w-fit', 'children' => (string) $c_15])|noescape}
{/if}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'class' => 'rounded bg-card inset-ring inset-ring-border p-6', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_16])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => '1-3', 'class' => 'gap-4', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_17])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_lead, 'tone' => $v_tone, 'density' => $v_density, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_18)])|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 zone-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/zone-table.json
Delivery zones and their prices as a table or as cards: the zone and its areas, the price, the order that ships free, the minimum order, the time and an express badge. Axes: layout (table, cards), tone, density.
Props (p): id, title, lead, zones, empty, labels, layout, tone, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_lead = og_def(p['lead'], '') -%}
{%- set v_zones = og_def(p['zones'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'table') -%}
{%- 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_18 -%}
{%- if og_t(og_eq(og_len(v_zones), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'map', 'title': v_empty}}) }}
{%- elif og_t(og_eq(v_layout, 'table')) %}
{{ og_include('blocks/zone-rows.html.j2', {'p': {'zones': v_zones, 'labels': v_labels}}) }}
{%- else %}
{%- set c_17 -%}
{%- for v_z in og_l(v_zones) %}
{%- set c_16 -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_z, ['name'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'lg', 'Weight': 'bold'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_text(og_get(v_z, ['area'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2'}, 'children': c_3}) }}
{%- set c_4 -%}
{{ og_text(og_money(og_get(v_z, ['price']), og_get(v_z, ['currency']))) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': '3xl', 'Weight': 'bold'}, 'children': c_4}) }}
{%- set c_14 -%}
{%- set c_7 -%}
{%- set c_5 -%}
{{ og_text(og_get(v_labels, ['freeFrom'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-muted-foreground'}, 'children': c_5}) }}
{%- set c_6 -%}
{{ og_text(og_money(og_get(v_z, ['freeFrom']), og_get(v_z, ['currency']))) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'font-medium'}, 'children': c_6}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex items-center justify-between gap-4 text-sm'}, 'children': c_7}) }}
{%- set c_10 -%}
{%- set c_8 -%}
{{ og_text(og_get(v_labels, ['minOrder'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-muted-foreground'}, 'children': c_8}) }}
{%- set c_9 -%}
{{ og_text(og_money(og_get(v_z, ['minOrder']), og_get(v_z, ['currency']))) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'font-medium'}, 'children': c_9}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex items-center justify-between gap-4 text-sm'}, 'children': c_10}) }}
{%- set c_13 -%}
{%- set c_11 -%}
{{ og_text(og_get(v_labels, ['time'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-muted-foreground'}, 'children': c_11}) }}
{%- set c_12 -%}
{{ og_text(og_get(v_z, ['time'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'font-medium'}, 'children': c_12}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex items-center justify-between gap-4 text-sm'}, 'children': c_13}) }}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Tag': 'ul', 'Class': 'flex flex-col gap-2 border-t border-border pt-4'}, 'children': c_14}) }}
{%- if og_t(og_get(v_z, ['express'])) %}
{%- set c_15 -%}
{{ og_text(og_get(v_z, ['express'])) }}
{%- endset -%}
{{ og_include('compose/badge.html.j2', {'p': {'Variant': 'secondary', 'Size': 'default', 'Class': 'w-fit'}, 'children': c_15}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Class': 'rounded bg-card inset-ring inset-ring-border p-6', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_16}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': '1-3', 'Class': 'gap-4', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_17}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_18)}) }}
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.
Delivery zones and their prices as a table or as cards: the zone and its areas, the price, the order that ships free, the minimum order, the time and an express badge. Axes: layout (table, cards), tone, density.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| lead | string | "" | |
| zones (required) | Zone[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| labels (required) | ZoneLabels | - | |
| layout | "table" | "cards" | "table" | |
| 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 |