Skip to content
ui8kit

block / commerce

Grill Builder

Choose the meat, the weight and the sides of a grill (mangal) dish.

Install

npx ui8kit add grill-builder

Pulls in: box, button, compose, dish-showcase, group, inline, kit-box, kit-button, kit-text, lucide-icon, meat-cards, option-chips, section-frame, side-checks, stack, text, utils

Preview

Build your grill dish

Choose the meat, the weight and the sides; we cook it over the coals.

Meat
$18.90 · per 500 g
$12.90 · per 500 g
$26.90 · per 500 g
$29.90 · per 500 g
Weight
Sides and sauces

Your order

Total

$18.90

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 grill-builder
blocks/grill-builder.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. -->
<!--
  A grill (mangal) dish builder: the meat as picture cards in a radio group, the weight as chips, the sides as
  checkboxes with prices, then a summary with the live total and the order button. Axes: layout (split,
  stacked), tone.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Dish, FoodLabels } from "./dish-showcase.types";
  import type { DishOption } from "../components/option-chips.types";

  export type GrillBuilderProps = {
    id: string;
    title: string;
    lead?: string;
    labels: FoodLabels;
    meats: DishOption[];
    weights: DishOption[];
    sides: DishOption[];
    total: number;
    currency: string;
    layout?: "split" | "stacked";
    tone?: "default" | "muted";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Button from "../compose/Button.svelte";
  import Group from "../compose/Group.svelte";
  import Inline from "../compose/Inline.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import MeatCards from "../components/meat-cards.svelte";
  import OptionChips from "../components/option-chips.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import SideChecks from "../components/side-checks.svelte";
  import { fmtMoney, tpl } from "../utils";

  let {
    id,
    title,
    lead = "",
    labels,
    meats,
    weights,
    sides,
    total,
    currency,
    layout = "split",
    tone = "default",
    landmarkLabel,
  }: GrillBuilderProps = $props();
</script>

<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
  <Box class="grid grid-cols-1 items-start gap-8 lg:grid-cols-3">
    <Box
      class={
        (layout as string) === "split" ? "flex flex-col gap-8 lg:col-span-2"
        : "flex flex-col gap-8 lg:col-span-3"
      }
      data-slot="steps"
    >
      <MeatCards name={tpl("{0}-meat", id)} legend={labels.meat} options={meats} />
      <OptionChips name={tpl("{0}-weight", id)} legend={labels.weight} options={weights} extra="note" />
      <SideChecks name={tpl("{0}-sides", id)} legend={labels.sides} options={sides} />
    </Box>
    <Stack
      gap="4"
      class={
        (layout as string) === "split" ? "rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6 lg:sticky lg:top-8"
        : "rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6"
      }
      data-slot="summary"
    >
      <Text size="lg" weight="semibold">
        {labels.summary}
      </Text>
      <Group gap="2" align="baseline" justify="between">
        <Text size="sm" class="text-muted-foreground">
          {labels.total}
        </Text>
        <Inline class="text-2xl font-bold" role="status" aria-live="polite" data-slot="total">
          {fmtMoney(total, currency)}
        </Inline>
      </Group>
      <Button variant="default" size="lg" type="button" class="w-full">
        <LucideIcon name="shopping-bag" size={16} />
        {labels.add}
      </Button>
    </Stack>
  </Box>
</SectionFrame>

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 grill-builder
blocks/grill-builder.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.
/**
 * A grill (mangal) dish builder: the meat as picture cards in a radio group, the weight as chips, the sides as
 * checkboxes with prices, then a summary with the live total and the order button. Axes: layout (split,
 * stacked), tone.
 */
import { type ReactNode } from "react";
import { Box, Button, Group, Inline, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MeatCards } from "../components/meat-cards";
import { OptionChips } from "../components/option-chips";
import { SectionFrame } from "../components/section-frame";
import { SideChecks } from "../components/side-checks";
import { fmtMoney, tpl } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishOption } from "../components/option-chips.types";

export type GrillBuilderProps = {
  id: string;
  title: string;
  lead?: string;
  labels: FoodLabels;
  meats: DishOption[];
  weights: DishOption[];
  sides: DishOption[];
  total: number;
  currency: string;
  layout?: "split" | "stacked";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function GrillBuilder({
  id,
  title,
  lead = "",
  labels,
  meats,
  weights,
  sides,
  total,
  currency,
  layout = "split",
  tone = "default",
  landmarkLabel,
}: GrillBuilderProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
      <Box className="grid grid-cols-1 items-start gap-8 lg:grid-cols-3">
        <Box
          className={
            (layout as string) === "split" ? "flex flex-col gap-8 lg:col-span-2"
            : "flex flex-col gap-8 lg:col-span-3"
          }
          data-slot="steps"
        >
          <MeatCards name={tpl("{0}-meat", id)} legend={labels.meat} options={meats} />
          <OptionChips name={tpl("{0}-weight", id)} legend={labels.weight} options={weights} extra="note" />
          <SideChecks name={tpl("{0}-sides", id)} legend={labels.sides} options={sides} />
        </Box>
        <Stack
          gap="4"
          className={
            (layout as string) === "split" ? "rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6 lg:sticky lg:top-8"
            : "rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6"
          }
          data-slot="summary"
        >
          <Text size="lg" weight="semibold">
            {labels.summary}
          </Text>
          <Group gap="2" align="baseline" justify="between">
            <Text size="sm" className="text-muted-foreground">
              {labels.total}
            </Text>
            <Inline className="text-2xl font-bold" role="status" aria-live="polite" data-slot="total">
              {fmtMoney(total, currency)}
            </Inline>
          </Group>
          <Button variant="default" size="lg" type="button" className="w-full">
            <LucideIcon name="shopping-bag" size={16} />
            {labels.add}
          </Button>
        </Stack>
      </Box>
    </SectionFrame>
  );
}

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 grill-builder
blocks/grill-builder.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. -->
<!--
  A grill (mangal) dish builder: the meat as picture cards in a radio group, the weight as chips, the sides as
  checkboxes with prices, then a summary with the live total and the order button. Axes: layout (split,
  stacked), tone.
-->
<script lang="ts">
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishOption } from "../components/option-chips.types";

export type GrillBuilderProps = {
  id: string;
  title: string;
  lead?: string;
  labels: FoodLabels;
  meats: DishOption[];
  weights: DishOption[];
  sides: DishOption[];
  total: number;
  currency: string;
  layout?: "split" | "stacked";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Button from "../compose/Button.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import MeatCards from "../components/meat-cards.vue";
import OptionChips from "../components/option-chips.vue";
import SectionFrame from "../components/section-frame.vue";
import SideChecks from "../components/side-checks.vue";
import { fmtMoney, tpl } from "../utils";

const {
  id,
  title,
  lead = "",
  labels,
  meats,
  weights,
  sides,
  total,
  currency,
  layout = "split",
  tone = "default",
  landmarkLabel,
} = defineProps<GrillBuilderProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :lead="lead" :tone="tone" :landmarkLabel="landmarkLabel">
    <Box class="grid grid-cols-1 items-start gap-8 lg:grid-cols-3">
      <Box
        :class="
          (layout as string) === 'split' ? 'flex flex-col gap-8 lg:col-span-2'
          : 'flex flex-col gap-8 lg:col-span-3'
        "
        data-slot="steps"
      >
        <MeatCards :name="tpl('{0}-meat', id)" :legend="labels.meat" :options="meats" />
        <OptionChips :name="tpl('{0}-weight', id)" :legend="labels.weight" :options="weights" extra="note" />
        <SideChecks :name="tpl('{0}-sides', id)" :legend="labels.sides" :options="sides" />
      </Box>
      <Stack
        gap="4"
        :class="
          (layout as string) === 'split' ? 'rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6 lg:sticky lg:top-8'
          : 'rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6'
        "
        data-slot="summary"
      >
        <Text size="lg" weight="semibold">
          {{ labels.summary }}
        </Text>
        <Group gap="2" align="baseline" justify="between">
          <Text size="sm" class="text-muted-foreground">
            {{ labels.total }}
          </Text>
          <Inline class="text-2xl font-bold" role="status" aria-live="polite" data-slot="total">
            {{ fmtMoney(total, currency) }}
          </Inline>
        </Group>
        <Button variant="default" size="lg" type="button" class="w-full">
          <LucideIcon name="shopping-bag" :size="16" />
          {{ labels.add }}
        </Button>
      </Stack>
    </Box>
  </SectionFrame>
</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 grill-builder
blocks/grill-builder.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.
/**
 * A grill (mangal) dish builder: the meat as picture cards in a radio group, the weight as chips, the sides as
 * checkboxes with prices, then a summary with the live total and the order button. Axes: layout (split,
 * stacked), tone.
 */
import { type JSX } from "solid-js";
import { Box, Button, Group, Inline, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MeatCards } from "../components/meat-cards";
import { OptionChips } from "../components/option-chips";
import { SectionFrame } from "../components/section-frame";
import { SideChecks } from "../components/side-checks";
import { fmtMoney, tpl } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishOption } from "../components/option-chips.types";

export type GrillBuilderProps = {
  id: string;
  title: string;
  lead?: string;
  labels: FoodLabels;
  meats: DishOption[];
  weights: DishOption[];
  sides: DishOption[];
  total: number;
  currency: string;
  layout?: "split" | "stacked";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function GrillBuilder({
  id,
  title,
  lead = "",
  labels,
  meats,
  weights,
  sides,
  total,
  currency,
  layout = "split",
  tone = "default",
  landmarkLabel,
}: GrillBuilderProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
      <Box class="grid grid-cols-1 items-start gap-8 lg:grid-cols-3">
        <Box
          class={
            (layout as string) === "split" ? "flex flex-col gap-8 lg:col-span-2"
            : "flex flex-col gap-8 lg:col-span-3"
          }
          data-slot="steps"
        >
          <MeatCards name={tpl("{0}-meat", id)} legend={labels.meat} options={meats} />
          <OptionChips name={tpl("{0}-weight", id)} legend={labels.weight} options={weights} extra="note" />
          <SideChecks name={tpl("{0}-sides", id)} legend={labels.sides} options={sides} />
        </Box>
        <Stack
          gap="4"
          class={
            (layout as string) === "split" ? "rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6 lg:sticky lg:top-8"
            : "rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6"
          }
          data-slot="summary"
        >
          <Text size="lg" weight="semibold">
            {labels.summary}
          </Text>
          <Group gap="2" align="baseline" justify="between">
            <Text size="sm" class="text-muted-foreground">
              {labels.total}
            </Text>
            <Inline class="text-2xl font-bold" role="status" aria-live="polite" data-slot="total">
              {fmtMoney(total, currency)}
            </Inline>
          </Group>
          <Button variant="default" size="lg" type="button" class="w-full">
            <LucideIcon name="shopping-bag" size={16} />
            {labels.add}
          </Button>
        </Stack>
      </Box>
    </SectionFrame>
  );
}

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 grill-builder
blocks/grill-builder.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/grill-builder.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/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// GrillBuilderProps are the props of GrillBuilder; the values are the JSON shapes of the TypeScript props.
type GrillBuilderProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Lead any `json:"lead"`
	Labels any `json:"labels"`
	Meats any `json:"meats"`
	Weights any `json:"weights"`
	Sides any `json:"sides"`
	Total any `json:"total"`
	Currency any `json:"currency"`
	Layout any `json:"layout"`
	Tone any `json:"tone"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A grill (mangal) dish builder: the meat as picture cards in a radio group, the weight as chips, the sides as checkboxes with prices, then a summary with the live total and the order button. Axes: layout (split, stacked), tone.
templ GrillBuilder(p GrillBuilderProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vLead := uiutils.Def(p.Lead, "") }}
	{{ vLabels := p.Labels }}
	{{ vMeats := p.Meats }}
	{{ vWeights := p.Weights }}
	{{ vSides := p.Sides }}
	{{ vTotal := p.Total }}
	{{ vCurrency := p.Currency }}
	{{ vLayout := uiutils.Def(p.Layout, "split") }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vLead, Tone: vTone, LandmarkLabel: vLandmarkLabel}) {
		@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "grid grid-cols-1 items-start gap-8 lg:grid-cols-3"}}) {
			@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "flex flex-col gap-8 lg:col-span-2", "flex flex-col gap-8 lg:col-span-3")), Attrs: uiutils.Attrs("data-slot", "steps")}}) {
				@MeatCards(MeatCardsProps{Name: uiutils.Tpl("{0}-meat", vId), Legend: uiutils.Get(vLabels, "meat"), Options: vMeats})
				@OptionChips(OptionChipsProps{Name: uiutils.Tpl("{0}-weight", vId), Legend: uiutils.Get(vLabels, "weight"), Options: vWeights, Extra: "note"})
				@SideChecks(SideChecksProps{Name: uiutils.Tpl("{0}-sides", vId), Legend: uiutils.Get(vLabels, "sides"), Options: vSides})
			}
			@compose.Stack(compose.StackProps{Gap: "4", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6 lg:sticky lg:top-8", "rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6")), Attrs: uiutils.Attrs("data-slot", "summary")}}) {
				@compose.Text(compose.TextProps{Size: "lg", Weight: "semibold", TextProps: text.TextProps{}}) {
					{ uiutils.Text(uiutils.Get(vLabels, "summary")) }
				}
				@compose.Group(compose.GroupProps{Gap: "2", Align: "baseline", Justify: "between", BoxProps: box.BoxProps{}}) {
					@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "total")) }
					}
					@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-2xl font-bold", Attrs: uiutils.Attrs("role", "status", "aria-live", "polite", "data-slot", "total")}}) {
						{ uiutils.Text(uiutils.Money(vTotal, vCurrency)) }
					}
				}
				@compose.Button(compose.ButtonProps{Variant: "default", Size: "lg", ButtonProps: button.ButtonProps{Type: "button", Class: "w-full"}}) {
					@icons.LucideIcon(icons.LucideIconProps{Name: "shopping-bag", Size: 16})
					{ uiutils.Text(uiutils.Get(vLabels, "add")) }
				}
			}
		}
	}
}

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 grill-builder
blocks/grill-builder.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/grill-builder.json
    A grill (mangal) dish builder: the meat as picture cards in a radio group, the weight as chips, the sides as checkboxes with prices, then a summary with the live total and the order button. Axes: layout (split, stacked), tone.
    Props (p): id, title, lead, labels, meats, weights, sides, total, currency, layout, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_lead = (p.lead ?? '') -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_meats = (p.meats ?? null) -%}
{%- set v_weights = (p.weights ?? null) -%}
{%- set v_sides = (p.sides ?? null) -%}
{%- set v_total = (p.total ?? null) -%}
{%- set v_currency = (p.currency ?? null) -%}
{%- set v_layout = (p.layout ?? 'split') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_9 -%}
  {%- set c_8 -%}
    {%- set c_1 -%}
      {{ include('blocks/meat-cards.html.twig', {'p': {'name': og_tpl('{0}-meat', [v_id]), 'legend': og_get(v_labels, ['meat']), 'options': v_meats}}, with_context = false) }}
      {{ include('blocks/option-chips.html.twig', {'p': {'name': og_tpl('{0}-weight', [v_id]), 'legend': og_get(v_labels, ['weight']), 'options': v_weights, 'extra': 'note'}}, with_context = false) }}
      {{ include('blocks/side-checks.html.twig', {'p': {'name': og_tpl('{0}-sides', [v_id]), 'legend': og_get(v_labels, ['sides']), 'options': v_sides}}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Box.html.twig', {'class': og_s((og_t(og_eq(v_layout, 'split')) ? 'flex flex-col gap-8 lg:col-span-2' : 'flex flex-col gap-8 lg:col-span-3')), 'attrs': og_attrs(['data-slot', 'steps']), 'children': c_1}, with_context = false) }}
    {%- set c_7 -%}
      {%- set c_2 -%}
        {{ og_text(og_get(v_labels, ['summary'])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'lg', 'weight': 'semibold', 'children': c_2}, with_context = false) }}
      {%- set c_5 -%}
        {%- set c_3 -%}
          {{ og_text(og_get(v_labels, ['total'])) }}
        {%- endset -%}
        {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
        {%- set c_4 -%}
          {{ og_text(og_money(v_total, v_currency)) }}
        {%- endset -%}
        {{ include('compose/Inline.html.twig', {'class': 'text-2xl font-bold', 'attrs': og_attrs(['role', 'status', 'aria-live', 'polite', 'data-slot', 'total']), 'children': c_4}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'baseline', 'justify': 'between', 'children': c_5}, with_context = false) }}
      {%- set c_6 -%}
        {{ include('icons/LucideIcon.html.twig', {'name': 'shopping-bag', 'size': 16}, with_context = false) }}
        {{ og_text(og_get(v_labels, ['add'])) }}
      {%- endset -%}
      {{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'lg', 'type': 'button', 'class': 'w-full', 'children': c_6}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Stack.html.twig', {'gap': '4', 'class': og_s((og_t(og_eq(v_layout, 'split')) ? 'rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6 lg:sticky lg:top-8' : 'rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6')), 'attrs': og_attrs(['data-slot', 'summary']), 'children': c_7}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Box.html.twig', {'class': 'grid grid-cols-1 items-start gap-8 lg:grid-cols-3', 'children': c_8}, with_context = false) }}
{%- 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_9)}, 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 grill-builder
blocks/grill-builder.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/grill-builder.json
    A grill (mangal) dish builder: the meat as picture cards in a radio group, the weight as chips, the sides as checkboxes with prices, then a summary with the live total and the order button. Axes: layout (split, stacked), tone.
    Props (p): id, title, lead, labels, meats, weights, sides, total, currency, layout, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_lead = ($p['lead'] ?? '')}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_meats = ($p['meats'] ?? null)}
{var $v_weights = ($p['weights'] ?? null)}
{var $v_sides = ($p['sides'] ?? null)}
{var $v_total = ($p['total'] ?? null)}
{var $v_currency = ($p['currency'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'split')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_9}
  {capture $c_8}
    {capture $c_1}
      {=og_include('blocks/meat-cards.latte', ['p' => ['name' => og_tpl('{0}-meat', [$v_id]), 'legend' => og_get($v_labels, ['meat']), 'options' => $v_meats]])|noescape}
      {=og_include('blocks/option-chips.latte', ['p' => ['name' => og_tpl('{0}-weight', [$v_id]), 'legend' => og_get($v_labels, ['weight']), 'options' => $v_weights, 'extra' => 'note']])|noescape}
      {=og_include('blocks/side-checks.latte', ['p' => ['name' => og_tpl('{0}-sides', [$v_id]), 'legend' => og_get($v_labels, ['sides']), 'options' => $v_sides]])|noescape}
    {/capture}
    {=og_include('compose/Box.latte', ['class' => og_s((og_t(og_eq($v_layout, 'split')) ? 'flex flex-col gap-8 lg:col-span-2' : 'flex flex-col gap-8 lg:col-span-3')), 'attrs' => og_attrs(['data-slot', 'steps']), 'children' => (string) $c_1])|noescape}
    {capture $c_7}
      {capture $c_2}
        {=og_text(og_get($v_labels, ['summary']))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'lg', 'weight' => 'semibold', 'children' => (string) $c_2])|noescape}
      {capture $c_5}
        {capture $c_3}
          {=og_text(og_get($v_labels, ['total']))}
        {/capture}
        {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
        {capture $c_4}
          {=og_text(og_money($v_total, $v_currency))}
        {/capture}
        {=og_include('compose/Inline.latte', ['class' => 'text-2xl font-bold', 'attrs' => og_attrs(['role', 'status', 'aria-live', 'polite', 'data-slot', 'total']), 'children' => (string) $c_4])|noescape}
      {/capture}
      {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'baseline', 'justify' => 'between', 'children' => (string) $c_5])|noescape}
      {capture $c_6}
        {=og_include('icons/LucideIcon.latte', ['name' => 'shopping-bag', 'size' => 16])|noescape}
        {=og_text(og_get($v_labels, ['add']))}
      {/capture}
      {=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'lg', 'type' => 'button', 'class' => 'w-full', 'children' => (string) $c_6])|noescape}
    {/capture}
    {=og_include('compose/Stack.latte', ['gap' => '4', 'class' => og_s((og_t(og_eq($v_layout, 'split')) ? 'rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6 lg:sticky lg:top-8' : 'rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6')), 'attrs' => og_attrs(['data-slot', 'summary']), 'children' => (string) $c_7])|noescape}
  {/capture}
  {=og_include('compose/Box.latte', ['class' => 'grid grid-cols-1 items-start gap-8 lg:grid-cols-3', 'children' => (string) $c_8])|noescape}
{/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_9)])|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 grill-builder
blocks/grill-builder.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/grill-builder.json
    A grill (mangal) dish builder: the meat as picture cards in a radio group, the weight as chips, the sides as checkboxes with prices, then a summary with the live total and the order button. Axes: layout (split, stacked), tone.
    Props (p): id, title, lead, labels, meats, weights, sides, total, currency, layout, 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_labels = og_def(p['labels'], none) -%}
{%- set v_meats = og_def(p['meats'], none) -%}
{%- set v_weights = og_def(p['weights'], none) -%}
{%- set v_sides = og_def(p['sides'], none) -%}
{%- set v_total = og_def(p['total'], none) -%}
{%- set v_currency = og_def(p['currency'], none) -%}
{%- set v_layout = og_def(p['layout'], 'split') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_9 -%}
  {%- set c_8 -%}
    {%- set c_1 -%}
      {{ og_include('blocks/meat-cards.html.j2', {'p': {'name': og_tpl('{0}-meat', [v_id]), 'legend': og_get(v_labels, ['meat']), 'options': v_meats}}) }}
      {{ og_include('blocks/option-chips.html.j2', {'p': {'name': og_tpl('{0}-weight', [v_id]), 'legend': og_get(v_labels, ['weight']), 'options': v_weights, 'extra': 'note'}}) }}
      {{ og_include('blocks/side-checks.html.j2', {'p': {'name': og_tpl('{0}-sides', [v_id]), 'legend': og_get(v_labels, ['sides']), 'options': v_sides}}) }}
    {%- endset -%}
    {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(('flex flex-col gap-8 lg:col-span-2' if og_t(og_eq(v_layout, 'split')) else 'flex flex-col gap-8 lg:col-span-3')), 'Attrs': og_attrs(['data-slot', 'steps'])}, 'children': c_1}) }}
    {%- set c_7 -%}
      {%- set c_2 -%}
        {{ og_text(og_get(v_labels, ['summary'])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'lg', 'Weight': 'semibold'}, 'children': c_2}) }}
      {%- set c_5 -%}
        {%- set c_3 -%}
          {{ og_text(og_get(v_labels, ['total'])) }}
        {%- endset -%}
        {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
        {%- set c_4 -%}
          {{ og_text(og_money(v_total, v_currency)) }}
        {%- endset -%}
        {{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-2xl font-bold', 'Attrs': og_attrs(['role', 'status', 'aria-live', 'polite', 'data-slot', 'total'])}, 'children': c_4}) }}
      {%- endset -%}
      {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'baseline', 'Justify': 'between'}, 'children': c_5}) }}
      {%- set c_6 -%}
        {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'shopping-bag', 'Size': 16}}) }}
        {{ og_text(og_get(v_labels, ['add'])) }}
      {%- endset -%}
      {{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'lg', 'Type': 'button', 'Class': 'w-full'}, 'children': c_6}) }}
    {%- endset -%}
    {{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Class': og_s(('rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6 lg:sticky lg:top-8' if og_t(og_eq(v_layout, 'split')) else 'rounded bg-card inset-ring inset-ring-border flex flex-col gap-4 p-6')), 'Attrs': og_attrs(['data-slot', 'summary'])}, 'children': c_7}) }}
  {%- endset -%}
  {{ og_include('compose/box.html.j2', {'p': {'Class': 'grid grid-cols-1 items-start gap-8 lg:grid-cols-3'}, 'children': c_8}) }}
{%- 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_9)}) }}

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.

A grill (mangal) dish builder: the meat as picture cards in a radio group, the weight as chips, the sides as checkboxes with prices, then a summary with the live total and the order button. Axes: layout (split, stacked), tone.

Props of GrillBuilder
PropTypeDefault Description
id (required)string-
title (required)string-
lead string""
labels (required)FoodLabels-
meats (required)DishOption[]-the meats, price per 500 g
weights (required)DishOption[]-the weights
sides (required)DishOption[]-the sides (checkboxes)
total (required)number-the total of the first choices, minor units
currency (required)string-
layout "split" | "stacked""split"
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