Quick Order
Compact rows with a one-click order button and a phone field.
Install
npx ui8kit add quick-orderPulls in: button, compose, dish-showcase, empty-state, field, group, inline, input, kit-box, kit-button, kit-input, kit-text, list, list-item, lucide-icon, section-frame, stack, text, utils
Preview
Quick order
Leave a phone number and order in one click.
- $11.50
Chicken rice bowl
420 g
Grilled chicken, rice, greens and a sesame dressing.
- $6.90
Tomato soup
350 ml
Slow-cooked tomato soup with basil oil and toast.
- $12.90
Creamy mushroom pasta
380 g
Fresh pasta with mushrooms, cream and parmesan.
- $8.50
Garden salad
260 g
Leaves, cucumber, radish and a lemon dressing.
- $11.90
Vegetable curry
450 g
Mild coconut curry with seasonal vegetables and rice.
- $8.90
Falafel wrap
300 g
Falafel, hummus, pickles and herbs in a warm flatbread.
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 quick-order<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Quick order in one click: compact rows (name, weight, summary, price) each with an order button named after
the dish, under a phone field that the one click uses. Axes: phone (show, hide), tone.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Dish, FoodLabels } from "./dish-showcase.types";
export type QuickOrderProps = {
id: string;
title: string;
lead?: string;
dishes: Dish[];
empty?: string;
labels: FoodLabels;
phone?: "show" | "hide";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Button from "../compose/Button.svelte";
import Group from "../compose/Group.svelte";
import Inline from "../compose/Inline.svelte";
import Input from "../compose/Input.svelte";
import List from "../compose/List.svelte";
import ListItem from "../compose/ListItem.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import EmptyState from "../components/empty-state.svelte";
import Field from "../components/field.svelte";
import SectionFrame from "../components/section-frame.svelte";
import { fmtMoney, tpl } from "../utils";
let {
id,
title,
lead = "",
dishes,
empty = "",
labels,
phone = "show",
tone = "default",
landmarkLabel,
}: QuickOrderProps = $props();
</script>
<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
{#if ((dishes?.length ?? 0) === 0)}
<EmptyState icon="zap" title={empty} />
{:else}
<Stack gap="4" align="stretch" class="mx-auto w-full max-w-3xl">
{#if ((phone as string) === "show")}
<Field label={labels.phone} htmlFor={tpl("{0}-phone", id)}>
<Input type="tel" name={tpl("{0}-phone", id)} id={tpl("{0}-phone", id)} />
</Field>
{/if}
<List tag="ul" class="flex flex-col" data-slot="items">
{#each dishes as d (d.id)}
<ListItem class="flex flex-wrap items-center gap-4 border-b border-border py-4" data-slot="item">
<Stack gap="0" class="min-w-0 flex-1">
<Group gap="2" align="baseline">
<Text size="base" weight="semibold">
{d.name}
</Text>
<Text size="xs" class="text-muted-foreground">
{d.weight}
</Text>
</Group>
<Text size="sm" class="text-muted-foreground">
{d.summary}
</Text>
</Stack>
<Inline class="text-base font-bold">
{fmtMoney(d.price, d.currency)}
</Inline>
<Button variant="default" size="sm" type="button" aria-label={tpl(labels.orderOf, d.name)}>
<LucideIcon name="zap" size={16} />
{labels.order}
</Button>
</ListItem>
{/each}
</List>
</Stack>
{/if}
</SectionFrame>
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 quick-order// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Quick order in one click: compact rows (name, weight, summary, price) each with an order button named after
* the dish, under a phone field that the one click uses. Axes: phone (show, hide), tone.
*/
import { type ReactNode } from "react";
import { Button, Group, Inline, Input, List, ListItem, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { Field } from "../components/field";
import { SectionFrame } from "../components/section-frame";
import { fmtMoney, tpl } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";
export type QuickOrderProps = {
id: string;
title: string;
lead?: string;
dishes: Dish[];
empty?: string;
labels: FoodLabels;
phone?: "show" | "hide";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function QuickOrder({
id,
title,
lead = "",
dishes,
empty = "",
labels,
phone = "show",
tone = "default",
landmarkLabel,
}: QuickOrderProps) {
return (
<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
{((dishes?.length ?? 0) === 0) ? (
<EmptyState icon="zap" title={empty} />
) : (
<Stack gap="4" align="stretch" className="mx-auto w-full max-w-3xl">
{((phone as string) === "show") ? (
<Field label={labels.phone} htmlFor={tpl("{0}-phone", id)}>
<Input type="tel" name={tpl("{0}-phone", id)} id={tpl("{0}-phone", id)} />
</Field>
) : null}
<List tag="ul" className="flex flex-col" data-slot="items">
{(dishes ?? []).map((d) => (
<ListItem key={d.id} className="flex flex-wrap items-center gap-4 border-b border-border py-4" data-slot="item">
<Stack gap="0" className="min-w-0 flex-1">
<Group gap="2" align="baseline">
<Text size="base" weight="semibold">
{d.name}
</Text>
<Text size="xs" className="text-muted-foreground">
{d.weight}
</Text>
</Group>
<Text size="sm" className="text-muted-foreground">
{d.summary}
</Text>
</Stack>
<Inline className="text-base font-bold">
{fmtMoney(d.price, d.currency)}
</Inline>
<Button variant="default" size="sm" type="button" aria-label={tpl(labels.orderOf, d.name)}>
<LucideIcon name="zap" size={16} />
{labels.order}
</Button>
</ListItem>
))}
</List>
</Stack>
)}
</SectionFrame>
);
}
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 quick-order<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Quick order in one click: compact rows (name, weight, summary, price) each with an order button named after
the dish, under a phone field that the one click uses. Axes: phone (show, hide), tone.
-->
<script lang="ts">
import type { Dish, FoodLabels } from "./dish-showcase.types";
export type QuickOrderProps = {
id: string;
title: string;
lead?: string;
dishes: Dish[];
empty?: string;
labels: FoodLabels;
phone?: "show" | "hide";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Button from "../compose/Button.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import Input from "../compose/Input.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import EmptyState from "../components/empty-state.vue";
import Field from "../components/field.vue";
import SectionFrame from "../components/section-frame.vue";
import { fmtMoney, tpl } from "../utils";
const {
id,
title,
lead = "",
dishes,
empty = "",
labels,
phone = "show",
tone = "default",
landmarkLabel,
} = defineProps<QuickOrderProps>();
</script>
<template>
<SectionFrame :id="id" :title="title" :lead="lead" :tone="tone" :landmarkLabel="landmarkLabel">
<EmptyState v-if="((dishes?.length ?? 0) === 0)" icon="zap" :title="empty" />
<Stack v-else gap="4" align="stretch" class="mx-auto w-full max-w-3xl">
<Field v-if="((phone as string) === 'show')" :label="labels.phone" :htmlFor="tpl('{0}-phone', id)">
<Input type="tel" :name="tpl('{0}-phone', id)" :id="tpl('{0}-phone', id)" />
</Field>
<List tag="ul" class="flex flex-col" data-slot="items">
<ListItem
v-for="d in dishes"
:key="d.id"
class="flex flex-wrap items-center gap-4 border-b border-border py-4"
data-slot="item"
>
<Stack gap="0" class="min-w-0 flex-1">
<Group gap="2" align="baseline">
<Text size="base" weight="semibold">
{{ d.name }}
</Text>
<Text size="xs" class="text-muted-foreground">
{{ d.weight }}
</Text>
</Group>
<Text size="sm" class="text-muted-foreground">
{{ d.summary }}
</Text>
</Stack>
<Inline class="text-base font-bold">
{{ fmtMoney(d.price, d.currency) }}
</Inline>
<Button variant="default" size="sm" type="button" :aria-label="tpl(labels.orderOf, d.name)">
<LucideIcon name="zap" :size="16" />
{{ labels.order }}
</Button>
</ListItem>
</List>
</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 quick-order// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Quick order in one click: compact rows (name, weight, summary, price) each with an order button named after
* the dish, under a phone field that the one click uses. Axes: phone (show, hide), tone.
*/
import { For, type JSX } from "solid-js";
import { Button, Group, Inline, Input, List, ListItem, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { Field } from "../components/field";
import { SectionFrame } from "../components/section-frame";
import { fmtMoney, tpl } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";
export type QuickOrderProps = {
id: string;
title: string;
lead?: string;
dishes: Dish[];
empty?: string;
labels: FoodLabels;
phone?: "show" | "hide";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function QuickOrder({
id,
title,
lead = "",
dishes,
empty = "",
labels,
phone = "show",
tone = "default",
landmarkLabel,
}: QuickOrderProps) {
return (
<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
{((dishes?.length ?? 0) === 0) ? (
<EmptyState icon="zap" title={empty} />
) : (
<Stack gap="4" align="stretch" class="mx-auto w-full max-w-3xl">
{((phone as string) === "show") ? (
<Field label={labels.phone} htmlFor={tpl("{0}-phone", id)}>
<Input type="tel" name={tpl("{0}-phone", id)} id={tpl("{0}-phone", id)} />
</Field>
) : null}
<List tag="ul" class="flex flex-col" data-slot="items">
<For each={dishes ?? []}>{(d) => (
<ListItem class="flex flex-wrap items-center gap-4 border-b border-border py-4" data-slot="item">
<Stack gap="0" class="min-w-0 flex-1">
<Group gap="2" align="baseline">
<Text size="base" weight="semibold">
{d.name}
</Text>
<Text size="xs" class="text-muted-foreground">
{d.weight}
</Text>
</Group>
<Text size="sm" class="text-muted-foreground">
{d.summary}
</Text>
</Stack>
<Inline class="text-base font-bold">
{fmtMoney(d.price, d.currency)}
</Inline>
<Button variant="default" size="sm" type="button" aria-label={tpl(labels.orderOf, d.name)}>
<LucideIcon name="zap" size={16} />
{labels.order}
</Button>
</ListItem>
)}</For>
</List>
</Stack>
)}
</SectionFrame>
);
}
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 quick-order// 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/quick-order.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/ui/button"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/icons"
"github.com/ui8kit/codegen/generated/templ/ui/input"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// QuickOrderProps are the props of QuickOrder; the values are the JSON shapes of the TypeScript props.
type QuickOrderProps struct {
Id any `json:"id"`
Title any `json:"title"`
Lead any `json:"lead"`
Dishes any `json:"dishes"`
Empty any `json:"empty"`
Labels any `json:"labels"`
Phone any `json:"phone"`
Tone any `json:"tone"`
LandmarkLabel any `json:"landmarkLabel"`
}
// Quick order in one click: compact rows (name, weight, summary, price) each with an order button named after the dish, under a phone field that the one click uses. Axes: phone (show, hide), tone.
templ QuickOrder(p QuickOrderProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vLead := uiutils.Def(p.Lead, "") }}
{{ vDishes := p.Dishes }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vLabels := p.Labels }}
{{ vPhone := uiutils.Def(p.Phone, "show") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vLead, Tone: vTone, LandmarkLabel: vLandmarkLabel}) {
if uiutils.Eq(uiutils.Len(vDishes), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "zap", Title: vEmpty})
} else {
@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{Class: "mx-auto w-full max-w-3xl"}}) {
if uiutils.Eq(vPhone, "show") {
@Field(FieldProps{Label: uiutils.Get(vLabels, "phone"), HtmlFor: uiutils.Tpl("{0}-phone", vId)}) {
@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "tel", Name: uiutils.S(uiutils.Tpl("{0}-phone", vId)), Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-phone", vId))}})
}
}
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ul", Class: "flex flex-col", Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vD := range uiutils.L(vDishes) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex flex-wrap items-center gap-4 border-b border-border py-4", Attrs: uiutils.Attrs("data-slot", "item")}}) {
@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{Class: "min-w-0 flex-1"}}) {
@compose.Group(compose.GroupProps{Gap: "2", Align: "baseline", BoxProps: box.BoxProps{}}) {
@compose.Text(compose.TextProps{Size: "base", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vD, "name")) }
}
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vD, "weight")) }
}
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vD, "summary")) }
}
}
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-base font-bold"}}) {
{ uiutils.Text(uiutils.Money(uiutils.Get(vD, "price"), uiutils.Get(vD, "currency"))) }
}
@compose.Button(compose.ButtonProps{Variant: "default", Size: "sm", ButtonProps: button.ButtonProps{Type: "button", AriaLabel: uiutils.S(uiutils.Tpl(uiutils.Get(vLabels, "orderOf"), uiutils.Get(vD, "name")))}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: "zap", Size: 16})
{ uiutils.Text(uiutils.Get(vLabels, "order")) }
}
}
}
}
}
}
}
}
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 quick-order{#- 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/quick-order.json
Quick order in one click: compact rows (name, weight, summary, price) each with an order button named after the dish, under a phone field that the one click uses. Axes: phone (show, hide), tone.
Props (p): id, title, lead, dishes, empty, labels, phone, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_lead = (p.lead ?? '') -%}
{%- set v_dishes = (p.dishes ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_phone = (p.phone ?? 'show') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_12 -%}
{%- if og_t(og_eq(og_len(v_dishes), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'zap', 'title': v_empty}}, with_context = false) }}
{%- else %}
{%- set c_11 -%}
{%- if og_t(og_eq(v_phone, 'show')) %}
{%- set c_1 -%}
{{ include('compose/Input.html.twig', {'type': 'tel', 'name': og_s(og_tpl('{0}-phone', [v_id])), 'attrs': og_attrs(['id', og_tpl('{0}-phone', [v_id])])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['phone']), 'htmlFor': og_tpl('{0}-phone', [v_id])}, 'children': og_markup(c_1)}, with_context = false) }}
{%- endif %}
{%- set c_10 -%}
{%- for v_d in og_l(v_dishes) %}
{%- set c_9 -%}
{%- set c_6 -%}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_d, ['name'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'base', 'weight': 'semibold', 'children': c_2}, with_context = false) }}
{%- set c_3 -%}
{{ og_text(og_get(v_d, ['weight'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'baseline', 'children': c_4}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_get(v_d, ['summary'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '0', 'class': 'min-w-0 flex-1', 'children': c_6}, with_context = false) }}
{%- set c_7 -%}
{{ og_text(og_money(og_get(v_d, ['price']), og_get(v_d, ['currency']))) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-base font-bold', 'children': c_7}, with_context = false) }}
{%- set c_8 -%}
{{ include('icons/LucideIcon.html.twig', {'name': 'zap', 'size': 16}, with_context = false) }}
{{ og_text(og_get(v_labels, ['order'])) }}
{%- endset -%}
{{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'sm', 'type': 'button', 'ariaLabel': og_s(og_tpl(og_get(v_labels, ['orderOf']), [og_get(v_d, ['name'])])), 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': 'flex flex-wrap items-center gap-4 border-b border-border py-4', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_9}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'tag': 'ul', 'class': 'flex flex-col', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_10}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'class': 'mx-auto w-full max-w-3xl', 'children': c_11}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_12)}, 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 quick-order{* 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/quick-order.json
Quick order in one click: compact rows (name, weight, summary, price) each with an order button named after the dish, under a phone field that the one click uses. Axes: phone (show, hide), tone.
Props (p): id, title, lead, dishes, empty, labels, phone, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_lead = ($p['lead'] ?? '')}
{var $v_dishes = ($p['dishes'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_phone = ($p['phone'] ?? 'show')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_12}
{if og_t(og_eq(og_len($v_dishes), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'zap', 'title' => $v_empty]])|noescape}
{else}
{capture $c_11}
{if og_t(og_eq($v_phone, 'show'))}
{capture $c_1}
{=og_include('compose/Input.latte', ['type' => 'tel', 'name' => og_s(og_tpl('{0}-phone', [$v_id])), 'attrs' => og_attrs(['id', og_tpl('{0}-phone', [$v_id])])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['phone']), 'htmlFor' => og_tpl('{0}-phone', [$v_id])], 'children' => og_markup($c_1)])|noescape}
{/if}
{capture $c_10}
{foreach og_l($v_dishes) as $v_d}
{capture $c_9}
{capture $c_6}
{capture $c_4}
{capture $c_2}
{=og_text(og_get($v_d, ['name']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'base', 'weight' => 'semibold', 'children' => (string) $c_2])|noescape}
{capture $c_3}
{=og_text(og_get($v_d, ['weight']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'baseline', 'children' => (string) $c_4])|noescape}
{capture $c_5}
{=og_text(og_get($v_d, ['summary']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '0', 'class' => 'min-w-0 flex-1', 'children' => (string) $c_6])|noescape}
{capture $c_7}
{=og_text(og_money(og_get($v_d, ['price']), og_get($v_d, ['currency'])))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-base font-bold', 'children' => (string) $c_7])|noescape}
{capture $c_8}
{=og_include('icons/LucideIcon.latte', ['name' => 'zap', 'size' => 16])|noescape}
{=og_text(og_get($v_labels, ['order']))}
{/capture}
{=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'sm', 'type' => 'button', 'ariaLabel' => og_s(og_tpl(og_get($v_labels, ['orderOf']), [og_get($v_d, ['name'])])), 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => 'flex flex-wrap items-center gap-4 border-b border-border py-4', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_9])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['tag' => 'ul', 'class' => 'flex flex-col', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_10])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'class' => 'mx-auto w-full max-w-3xl', 'children' => (string) $c_11])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_lead, 'tone' => $v_tone, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_12)])|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 quick-order{#- 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/quick-order.json
Quick order in one click: compact rows (name, weight, summary, price) each with an order button named after the dish, under a phone field that the one click uses. Axes: phone (show, hide), tone.
Props (p): id, title, lead, dishes, empty, labels, phone, tone, 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_dishes = og_def(p['dishes'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_phone = og_def(p['phone'], 'show') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_12 -%}
{%- if og_t(og_eq(og_len(v_dishes), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'zap', 'title': v_empty}}) }}
{%- else %}
{%- set c_11 -%}
{%- if og_t(og_eq(v_phone, 'show')) %}
{%- set c_1 -%}
{{ og_include('compose/input.html.j2', {'p': {'Type': 'tel', 'Name': og_s(og_tpl('{0}-phone', [v_id])), 'Attrs': og_attrs(['id', og_tpl('{0}-phone', [v_id])])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['phone']), 'htmlFor': og_tpl('{0}-phone', [v_id])}, 'children': og_markup(c_1)}) }}
{%- endif %}
{%- set c_10 -%}
{%- for v_d in og_l(v_dishes) %}
{%- set c_9 -%}
{%- set c_6 -%}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_d, ['name'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'base', 'Weight': 'semibold'}, 'children': c_2}) }}
{%- set c_3 -%}
{{ og_text(og_get(v_d, ['weight'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'baseline'}, 'children': c_4}) }}
{%- set c_5 -%}
{{ og_text(og_get(v_d, ['summary'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '0', 'Class': 'min-w-0 flex-1'}, 'children': c_6}) }}
{%- set c_7 -%}
{{ og_text(og_money(og_get(v_d, ['price']), og_get(v_d, ['currency']))) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-base font-bold'}, 'children': c_7}) }}
{%- set c_8 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'zap', 'Size': 16}}) }}
{{ og_text(og_get(v_labels, ['order'])) }}
{%- endset -%}
{{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'sm', 'Type': 'button', 'AriaLabel': og_s(og_tpl(og_get(v_labels, ['orderOf']), [og_get(v_d, ['name'])]))}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex flex-wrap items-center gap-4 border-b border-border py-4', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_9}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Tag': 'ul', 'Class': 'flex flex-col', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_10}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch', 'Class': 'mx-auto w-full max-w-3xl'}, 'children': c_11}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_12)}) }}
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.
Quick order in one click: compact rows (name, weight, summary, price) each with an order button named after the dish, under a phone field that the one click uses. Axes: phone (show, hide), tone.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| lead | string | "" | |
| dishes (required) | Dish[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| labels (required) | FoodLabels | - | |
| phone | "show" | "hide" | "show" | |
| tone | "default" | "muted" | "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 |