Skip to content
ui8kit

block / commerce

Dish Bento

One featured dish in a large tile among smaller ones.

Install

npx ui8kit add dish-bento

Pulls in: add-icon, badge, box, compose, dish-showcase, empty-state, group, inline, kit-box, kit-link, kit-text, link, lucide-icon, media-frame, section-frame, stack, text, title, utils

Preview

From the grill

The chef's pick and the dishes around it.

1.2 kg

Grill platter for two

Pork neck, chicken thigh, lamb kebab, grilled vegetables and three sauces.

Smoked ribs

$24.90

Lamb kebab

$16.90

Chicken wings

$12.90

Grilled corn

$5.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 dish-bento
blocks/dish-bento.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. -->
<!--
  Featured dishes as a bento: the first dish in a large tile (two by two) with its summary and a link to its
  page, the others in small tiles around it. Axes: feature (start, end), tone.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Dish, FoodLabels } from "./dish-showcase.types";

  export type DishBentoProps = {
    id: string;
    title: string;
    lead?: string;
    dishes: Dish[];
    empty?: string;
    labels: FoodLabels;
    feature?: "start" | "end";
    tone?: "default" | "muted";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Badge from "../compose/Badge.svelte";
  import Box from "../compose/Box.svelte";
  import Group from "../compose/Group.svelte";
  import Inline from "../compose/Inline.svelte";
  import Link from "../compose/Link.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import Title from "../compose/Title.svelte";
  import AddIcon from "../components/add-icon.svelte";
  import EmptyState from "../components/empty-state.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { cn, fmtMoney, tpl, urlOf } from "../utils";

  let {
    id,
    title,
    lead = "",
    dishes,
    empty = "",
    labels,
    feature = "start",
    tone = "default",
    landmarkLabel,
  }: DishBentoProps = $props();
</script>

<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
  {#if ((dishes?.length ?? 0) === 0)}
    <EmptyState icon="star" title={empty} />
  {:else}
    <Box class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4" data-slot="items">
      {#each dishes as d, i (d.id)}
        {#if (i === 0)}
          <Stack
            gap="4"
            class={cn(
              "rounded bg-card inset-ring inset-ring-border p-6 sm:col-span-2 lg:row-span-2",
              (((feature as string) === "end") ? "lg:col-start-3 lg:row-start-1" : "")
            )}
            data-slot="feature"
          >
            <MediaFrame alt={d.name} src={d.image} ratio="4/3" />
            <Badge variant="secondary" size="default" class="w-fit">
              {d.weight}
            </Badge>
            <Title as={3} size="2xl" weight="bold">
              {d.name}
            </Title>
            <Text size="base" class="text-muted-foreground">
              {d.summary}
            </Text>
            <Group gap="4" align="center" justify="between" class="mt-auto">
              <Inline class="text-xl font-bold">
                {fmtMoney(d.price, d.currency)}
              </Inline>
              <Link href={urlOf((d.href ?? tpl("#/dish/{0}", d.id)))} variant="default">
                {labels.open}
                <LucideIcon name="arrow-right" size={16} />
              </Link>
            </Group>
          </Stack>
        {:else}
          <Stack gap="2" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
            <MediaFrame alt={d.name} src={d.image} />
            <Text size="sm" weight="semibold">
              {d.name}
            </Text>
            <Group gap="2" align="center" justify="between">
              <Inline class="text-sm font-bold">
                {fmtMoney(d.price, d.currency)}
              </Inline>
              <AddIcon label={tpl(labels.addOf, d.name)} />
            </Group>
          </Stack>
        {/if}
      {/each}
    </Box>
  {/if}
</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 dish-bento
blocks/dish-bento.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.
/**
 * Featured dishes as a bento: the first dish in a large tile (two by two) with its summary and a link to its
 * page, the others in small tiles around it. Axes: feature (start, end), tone.
 */
import { Fragment, type ReactNode } from "react";
import { Badge, Box, Group, Inline, Link, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { AddIcon } from "../components/add-icon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { cn, fmtMoney, tpl, urlOf } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";

export type DishBentoProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  empty?: string;
  labels: FoodLabels;
  feature?: "start" | "end";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function DishBento({
  id,
  title,
  lead = "",
  dishes,
  empty = "",
  labels,
  feature = "start",
  tone = "default",
  landmarkLabel,
}: DishBentoProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
      {((dishes?.length ?? 0) === 0) ? (
        <EmptyState icon="star" title={empty} />
      ) : (
        <Box className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4" data-slot="items">
          {(dishes ?? []).map((d, i) => (
            <Fragment key={d.id}>
              {(i === 0) ? (
                <Stack
                  gap="4"
                  className={cn(
                    "rounded bg-card inset-ring inset-ring-border p-6 sm:col-span-2 lg:row-span-2",
                    (((feature as string) === "end") ? "lg:col-start-3 lg:row-start-1" : "")
                  )}
                  data-slot="feature"
                >
                  <MediaFrame alt={d.name} src={d.image} ratio="4/3" />
                  <Badge variant="secondary" size="default" className="w-fit">
                    {d.weight}
                  </Badge>
                  <Title as={3} size="2xl" weight="bold">
                    {d.name}
                  </Title>
                  <Text size="base" className="text-muted-foreground">
                    {d.summary}
                  </Text>
                  <Group gap="4" align="center" justify="between" className="mt-auto">
                    <Inline className="text-xl font-bold">
                      {fmtMoney(d.price, d.currency)}
                    </Inline>
                    <Link href={urlOf((d.href ?? tpl("#/dish/{0}", d.id)))} variant="default">
                      {labels.open}
                      <LucideIcon name="arrow-right" size={16} />
                    </Link>
                  </Group>
                </Stack>
              ) : (
                <Stack gap="2" className="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
                  <MediaFrame alt={d.name} src={d.image} />
                  <Text size="sm" weight="semibold">
                    {d.name}
                  </Text>
                  <Group gap="2" align="center" justify="between">
                    <Inline className="text-sm font-bold">
                      {fmtMoney(d.price, d.currency)}
                    </Inline>
                    <AddIcon label={tpl(labels.addOf, d.name)} />
                  </Group>
                </Stack>
              )}
            </Fragment>
          ))}
        </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 dish-bento
blocks/dish-bento.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. -->
<!--
  Featured dishes as a bento: the first dish in a large tile (two by two) with its summary and a link to its
  page, the others in small tiles around it. Axes: feature (start, end), tone.
-->
<script lang="ts">
import type { Dish, FoodLabels } from "./dish-showcase.types";

export type DishBentoProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  empty?: string;
  labels: FoodLabels;
  feature?: "start" | "end";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Badge from "../compose/Badge.vue";
import Box from "../compose/Box.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import Link from "../compose/Link.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import AddIcon from "../components/add-icon.vue";
import EmptyState from "../components/empty-state.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";
import { cn, fmtMoney, tpl, urlOf } from "../utils";

const {
  id,
  title,
  lead = "",
  dishes,
  empty = "",
  labels,
  feature = "start",
  tone = "default",
  landmarkLabel,
} = defineProps<DishBentoProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :lead="lead" :tone="tone" :landmarkLabel="landmarkLabel">
    <EmptyState v-if="((dishes?.length ?? 0) === 0)" icon="star" :title="empty" />
    <Box v-else class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4" data-slot="items">
      <template v-for="(d, i) in dishes" :key="d.id">
        <Stack v-if="(i === 0)"
          gap="4"
          :class="cn(
            'rounded bg-card inset-ring inset-ring-border p-6 sm:col-span-2 lg:row-span-2',
            (((feature as string) === 'end') ? 'lg:col-start-3 lg:row-start-1' : '')
          )"
          data-slot="feature"
        >
          <MediaFrame :alt="d.name" :src="d.image" ratio="4/3" />
          <Badge variant="secondary" size="default" class="w-fit">
            {{ d.weight }}
          </Badge>
          <Title :as="3" size="2xl" weight="bold">
            {{ d.name }}
          </Title>
          <Text size="base" class="text-muted-foreground">
            {{ d.summary }}
          </Text>
          <Group gap="4" align="center" justify="between" class="mt-auto">
            <Inline class="text-xl font-bold">
              {{ fmtMoney(d.price, d.currency) }}
            </Inline>
            <Link :href="urlOf((d.href ?? tpl('#/dish/{0}', d.id)))" variant="default">
              {{ labels.open }}
              <LucideIcon name="arrow-right" :size="16" />
            </Link>
          </Group>
        </Stack>
        <Stack v-else gap="2" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
          <MediaFrame :alt="d.name" :src="d.image" />
          <Text size="sm" weight="semibold">
            {{ d.name }}
          </Text>
          <Group gap="2" align="center" justify="between">
            <Inline class="text-sm font-bold">
              {{ fmtMoney(d.price, d.currency) }}
            </Inline>
            <AddIcon :label="tpl(labels.addOf, d.name)" />
          </Group>
        </Stack>
      </template>
    </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 dish-bento
blocks/dish-bento.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.
/**
 * Featured dishes as a bento: the first dish in a large tile (two by two) with its summary and a link to its
 * page, the others in small tiles around it. Axes: feature (start, end), tone.
 */
import { For, type JSX } from "solid-js";
import { Badge, Box, Group, Inline, Link, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { AddIcon } from "../components/add-icon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { cn, fmtMoney, tpl, urlOf } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";

export type DishBentoProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  empty?: string;
  labels: FoodLabels;
  feature?: "start" | "end";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function DishBento({
  id,
  title,
  lead = "",
  dishes,
  empty = "",
  labels,
  feature = "start",
  tone = "default",
  landmarkLabel,
}: DishBentoProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
      {((dishes?.length ?? 0) === 0) ? (
        <EmptyState icon="star" title={empty} />
      ) : (
        <Box class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4" data-slot="items">
          <For each={dishes ?? []}>{(d, iOf) => { const i = iOf(); return (
            <>
              {(i === 0) ? (
                <Stack
                  gap="4"
                  class={cn(
                    "rounded bg-card inset-ring inset-ring-border p-6 sm:col-span-2 lg:row-span-2",
                    (((feature as string) === "end") ? "lg:col-start-3 lg:row-start-1" : "")
                  )}
                  data-slot="feature"
                >
                  <MediaFrame alt={d.name} src={d.image} ratio="4/3" />
                  <Badge variant="secondary" size="default" class="w-fit">
                    {d.weight}
                  </Badge>
                  <Title as={3} size="2xl" weight="bold">
                    {d.name}
                  </Title>
                  <Text size="base" class="text-muted-foreground">
                    {d.summary}
                  </Text>
                  <Group gap="4" align="center" justify="between" class="mt-auto">
                    <Inline class="text-xl font-bold">
                      {fmtMoney(d.price, d.currency)}
                    </Inline>
                    <Link href={urlOf((d.href ?? tpl("#/dish/{0}", d.id)))} variant="default">
                      {labels.open}
                      <LucideIcon name="arrow-right" size={16} />
                    </Link>
                  </Group>
                </Stack>
              ) : (
                <Stack gap="2" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
                  <MediaFrame alt={d.name} src={d.image} />
                  <Text size="sm" weight="semibold">
                    {d.name}
                  </Text>
                  <Group gap="2" align="center" justify="between">
                    <Inline class="text-sm font-bold">
                      {fmtMoney(d.price, d.currency)}
                    </Inline>
                    <AddIcon label={tpl(labels.addOf, d.name)} />
                  </Group>
                </Stack>
              )}
            </>
          ); }}</For>
        </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 dish-bento
blocks/dish-bento.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/dish-bento.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/icons"
	"github.com/ui8kit/codegen/generated/templ/ui/link"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// DishBentoProps are the props of DishBento; the values are the JSON shapes of the TypeScript props.
type DishBentoProps 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"`
	Feature any `json:"feature"`
	Tone any `json:"tone"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// Featured dishes as a bento: the first dish in a large tile (two by two) with its summary and a link to its page, the others in small tiles around it. Axes: feature (start, end), tone.
templ DishBento(p DishBentoProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vLead := uiutils.Def(p.Lead, "") }}
	{{ vDishes := p.Dishes }}
	{{ vEmpty := uiutils.Def(p.Empty, "") }}
	{{ vLabels := p.Labels }}
	{{ vFeature := uiutils.Def(p.Feature, "start") }}
	{{ 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: "star", Title: vEmpty})
		} else {
			@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4", Attrs: uiutils.Attrs("data-slot", "items")}}) {
				for vI, vD := range uiutils.L(vDishes) {
					if uiutils.Eq(float64(vI), float64(0)) {
						@compose.Stack(compose.StackProps{Gap: "4", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("rounded bg-card inset-ring inset-ring-border p-6 sm:col-span-2 lg:row-span-2", uiutils.Cond(uiutils.T(uiutils.Eq(vFeature, "end")), "lg:col-start-3 lg:row-start-1", ""))), Attrs: uiutils.Attrs("data-slot", "feature")}}) {
							@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vD, "name"), Src: uiutils.Get(vD, "image"), Ratio: "4/3"})
							@compose.Badge(compose.BadgeProps{Variant: "secondary", Size: "default", TextProps: text.TextProps{Class: "w-fit"}}) {
								{ uiutils.Text(uiutils.Get(vD, "weight")) }
							}
							@compose.Title(compose.TitleProps{As: "3", Size: "2xl", Weight: "bold", TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.Get(vD, "name")) }
							}
							@compose.Text(compose.TextProps{Size: "base", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
								{ uiutils.Text(uiutils.Get(vD, "summary")) }
							}
							@compose.Group(compose.GroupProps{Gap: "4", Align: "center", Justify: "between", BoxProps: box.BoxProps{Class: "mt-auto"}}) {
								@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-xl font-bold"}}) {
									{ uiutils.Text(uiutils.Money(uiutils.Get(vD, "price"), uiutils.Get(vD, "currency"))) }
								}
								@compose.Link(compose.LinkProps{Variant: "default", LinkProps: link.LinkProps{Href: uiutils.URL(uiutils.Coalesce(uiutils.Get(vD, "href"), uiutils.Tpl("#/dish/{0}", uiutils.Get(vD, "id"))), false)}}) {
									{ uiutils.Text(uiutils.Get(vLabels, "open")) }
									@icons.LucideIcon(icons.LucideIconProps{Name: "arrow-right", Size: 16})
								}
							}
						}
					} else {
						@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-4", Attrs: uiutils.Attrs("data-slot", "item")}}) {
							@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vD, "name"), Src: uiutils.Get(vD, "image")})
							@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.Get(vD, "name")) }
							}
							@compose.Group(compose.GroupProps{Gap: "2", Align: "center", Justify: "between", BoxProps: box.BoxProps{}}) {
								@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-sm font-bold"}}) {
									{ uiutils.Text(uiutils.Money(uiutils.Get(vD, "price"), uiutils.Get(vD, "currency"))) }
								}
								@AddIcon(AddIconProps{Label: uiutils.Tpl(uiutils.Get(vLabels, "addOf"), uiutils.Get(vD, "name"))})
							}
						}
					}
				}
			}
		}
	}
}

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 dish-bento
blocks/dish-bento.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/dish-bento.json
    Featured dishes as a bento: the first dish in a large tile (two by two) with its summary and a link to its page, the others in small tiles around it. Axes: feature (start, end), tone.
    Props (p): id, title, lead, dishes, empty, labels, feature, 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_feature = (p.feature ?? 'start') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_13 -%}
  {%- if og_t(og_eq(og_len(v_dishes), 0)) %}
    {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'star', 'title': v_empty}}, with_context = false) }}
  {%- else %}
    {%- set c_12 -%}
      {%- for v_d in og_l(v_dishes) %}
        {%- set v_i = loop.index0 -%}
        {%- if og_t(og_eq(v_i, 0)) %}
          {%- set c_7 -%}
            {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image']), 'ratio': '4/3'}}, with_context = false) }}
            {%- set c_1 -%}
              {{ og_text(og_get(v_d, ['weight'])) }}
            {%- endset -%}
            {{ include('compose/Badge.html.twig', {'variant': 'secondary', 'size': 'default', 'class': 'w-fit', 'children': c_1}, with_context = false) }}
            {%- set c_2 -%}
              {{ og_text(og_get(v_d, ['name'])) }}
            {%- endset -%}
            {{ include('compose/Title.html.twig', {'as': 3, 'size': '2xl', 'weight': 'bold', 'children': c_2}, with_context = false) }}
            {%- set c_3 -%}
              {{ og_text(og_get(v_d, ['summary'])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'base', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
            {%- set c_6 -%}
              {%- set c_4 -%}
                {{ og_text(og_money(og_get(v_d, ['price']), og_get(v_d, ['currency']))) }}
              {%- endset -%}
              {{ include('compose/Inline.html.twig', {'class': 'text-xl font-bold', 'children': c_4}, with_context = false) }}
              {%- set c_5 -%}
                {{ og_text(og_get(v_labels, ['open'])) }}
                {{ include('icons/LucideIcon.html.twig', {'name': 'arrow-right', 'size': 16}, with_context = false) }}
              {%- endset -%}
              {{ include('compose/Link.html.twig', {'href': og_url(og_s(og_coalesce([og_get(v_d, ['href']), og_tpl('#/dish/{0}', [og_get(v_d, ['id'])])]))), 'variant': 'default', 'children': c_5}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'justify': 'between', 'class': 'mt-auto', 'children': c_6}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': '4', 'class': og_s(og_cnv(['rounded bg-card inset-ring inset-ring-border p-6 sm:col-span-2 lg:row-span-2', (og_t(og_eq(v_feature, 'end')) ? 'lg:col-start-3 lg:row-start-1' : '')])), 'attrs': og_attrs(['data-slot', 'feature']), 'children': c_7}, with_context = false) }}
        {%- else %}
          {%- set c_11 -%}
            {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image'])}}, with_context = false) }}
            {%- set c_8 -%}
              {{ og_text(og_get(v_d, ['name'])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_8}, with_context = false) }}
            {%- set c_10 -%}
              {%- set c_9 -%}
                {{ og_text(og_money(og_get(v_d, ['price']), og_get(v_d, ['currency']))) }}
              {%- endset -%}
              {{ include('compose/Inline.html.twig', {'class': 'text-sm font-bold', 'children': c_9}, with_context = false) }}
              {{ include('blocks/add-icon.html.twig', {'p': {'label': og_tpl(og_get(v_labels, ['addOf']), [og_get(v_d, ['name'])])}}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'justify': 'between', 'children': c_10}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': '2', 'class': 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_11}, with_context = false) }}
        {%- endif %}
      {%- endfor %}
    {%- endset -%}
    {{ include('compose/Box.html.twig', {'class': 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_12}, 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_13)}, 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 dish-bento
blocks/dish-bento.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/dish-bento.json
    Featured dishes as a bento: the first dish in a large tile (two by two) with its summary and a link to its page, the others in small tiles around it. Axes: feature (start, end), tone.
    Props (p): id, title, lead, dishes, empty, labels, feature, 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_feature = ($p['feature'] ?? 'start')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_13}
  {if og_t(og_eq(og_len($v_dishes), 0))}
    {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'star', 'title' => $v_empty]])|noescape}
  {else}
    {capture $c_12}
      {foreach og_l($v_dishes) as $v_d}
        {var $v_i = $iterator->counter0}
        {if og_t(og_eq($v_i, 0))}
          {capture $c_7}
            {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_d, ['name']), 'src' => og_get($v_d, ['image']), 'ratio' => '4/3']])|noescape}
            {capture $c_1}
              {=og_text(og_get($v_d, ['weight']))}
            {/capture}
            {=og_include('compose/Badge.latte', ['variant' => 'secondary', 'size' => 'default', 'class' => 'w-fit', 'children' => (string) $c_1])|noescape}
            {capture $c_2}
              {=og_text(og_get($v_d, ['name']))}
            {/capture}
            {=og_include('compose/Title.latte', ['as' => 3, 'size' => '2xl', 'weight' => 'bold', 'children' => (string) $c_2])|noescape}
            {capture $c_3}
              {=og_text(og_get($v_d, ['summary']))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'base', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
            {capture $c_6}
              {capture $c_4}
                {=og_text(og_money(og_get($v_d, ['price']), og_get($v_d, ['currency'])))}
              {/capture}
              {=og_include('compose/Inline.latte', ['class' => 'text-xl font-bold', 'children' => (string) $c_4])|noescape}
              {capture $c_5}
                {=og_text(og_get($v_labels, ['open']))}
                {=og_include('icons/LucideIcon.latte', ['name' => 'arrow-right', 'size' => 16])|noescape}
              {/capture}
              {=og_include('compose/Link.latte', ['href' => og_url(og_s(og_coalesce([og_get($v_d, ['href']), og_tpl('#/dish/{0}', [og_get($v_d, ['id'])])]))), 'variant' => 'default', 'children' => (string) $c_5])|noescape}
            {/capture}
            {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'justify' => 'between', 'class' => 'mt-auto', 'children' => (string) $c_6])|noescape}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => '4', 'class' => og_s(og_cnv(['rounded bg-card inset-ring inset-ring-border p-6 sm:col-span-2 lg:row-span-2', (og_t(og_eq($v_feature, 'end')) ? 'lg:col-start-3 lg:row-start-1' : '')])), 'attrs' => og_attrs(['data-slot', 'feature']), 'children' => (string) $c_7])|noescape}
        {else}
          {capture $c_11}
            {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_d, ['name']), 'src' => og_get($v_d, ['image'])]])|noescape}
            {capture $c_8}
              {=og_text(og_get($v_d, ['name']))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_8])|noescape}
            {capture $c_10}
              {capture $c_9}
                {=og_text(og_money(og_get($v_d, ['price']), og_get($v_d, ['currency'])))}
              {/capture}
              {=og_include('compose/Inline.latte', ['class' => 'text-sm font-bold', 'children' => (string) $c_9])|noescape}
              {=og_include('blocks/add-icon.latte', ['p' => ['label' => og_tpl(og_get($v_labels, ['addOf']), [og_get($v_d, ['name'])])]])|noescape}
            {/capture}
            {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'justify' => 'between', 'children' => (string) $c_10])|noescape}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => '2', 'class' => 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_11])|noescape}
        {/if}
      {/foreach}
    {/capture}
    {=og_include('compose/Box.latte', ['class' => 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_12])|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_13)])|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 dish-bento
blocks/dish-bento.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/dish-bento.json
    Featured dishes as a bento: the first dish in a large tile (two by two) with its summary and a link to its page, the others in small tiles around it. Axes: feature (start, end), tone.
    Props (p): id, title, lead, dishes, empty, labels, feature, 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_feature = og_def(p['feature'], 'start') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_13 -%}
  {%- if og_t(og_eq(og_len(v_dishes), 0)) %}
    {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'star', 'title': v_empty}}) }}
  {%- else %}
    {%- set c_12 -%}
      {%- for v_d in og_l(v_dishes) %}
        {%- set v_i = loop.index0 -%}
        {%- if og_t(og_eq(v_i, 0)) %}
          {%- set c_7 -%}
            {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image']), 'ratio': '4/3'}}) }}
            {%- set c_1 -%}
              {{ og_text(og_get(v_d, ['weight'])) }}
            {%- endset -%}
            {{ og_include('compose/badge.html.j2', {'p': {'Variant': 'secondary', 'Size': 'default', 'Class': 'w-fit'}, 'children': c_1}) }}
            {%- set c_2 -%}
              {{ og_text(og_get(v_d, ['name'])) }}
            {%- endset -%}
            {{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': '2xl', 'Weight': 'bold'}, 'children': c_2}) }}
            {%- set c_3 -%}
              {{ og_text(og_get(v_d, ['summary'])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'base', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
            {%- set c_6 -%}
              {%- set c_4 -%}
                {{ og_text(og_money(og_get(v_d, ['price']), og_get(v_d, ['currency']))) }}
              {%- endset -%}
              {{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-xl font-bold'}, 'children': c_4}) }}
              {%- set c_5 -%}
                {{ og_text(og_get(v_labels, ['open'])) }}
                {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'arrow-right', 'Size': 16}}) }}
              {%- endset -%}
              {{ og_include('compose/link.html.j2', {'p': {'Href': og_url(og_s(og_coalesce([og_get(v_d, ['href']), og_tpl('#/dish/{0}', [og_get(v_d, ['id'])])]))), 'Variant': 'default'}, 'children': c_5}) }}
            {%- endset -%}
            {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Justify': 'between', 'Class': 'mt-auto'}, 'children': c_6}) }}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Class': og_s(og_cnv(['rounded bg-card inset-ring inset-ring-border p-6 sm:col-span-2 lg:row-span-2', ('lg:col-start-3 lg:row-start-1' if og_t(og_eq(v_feature, 'end')) else '')])), 'Attrs': og_attrs(['data-slot', 'feature'])}, 'children': c_7}) }}
        {%- else %}
          {%- set c_11 -%}
            {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image'])}}) }}
            {%- set c_8 -%}
              {{ og_text(og_get(v_d, ['name'])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_8}) }}
            {%- set c_10 -%}
              {%- set c_9 -%}
                {{ og_text(og_money(og_get(v_d, ['price']), og_get(v_d, ['currency']))) }}
              {%- endset -%}
              {{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-sm font-bold'}, 'children': c_9}) }}
              {{ og_include('blocks/add-icon.html.j2', {'p': {'label': og_tpl(og_get(v_labels, ['addOf']), [og_get(v_d, ['name'])])}}) }}
            {%- endset -%}
            {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Justify': 'between'}, 'children': c_10}) }}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Class': 'rounded bg-card inset-ring inset-ring-border p-4', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_11}) }}
        {%- endif %}
      {%- endfor %}
    {%- endset -%}
    {{ og_include('compose/box.html.j2', {'p': {'Class': 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_12}) }}
  {%- 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_13)}) }}

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.

Featured dishes as a bento: the first dish in a large tile (two by two) with its summary and a link to its page, the others in small tiles around it. Axes: feature (start, end), tone.

Props of DishBento
PropTypeDefault 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-
feature "start" | "end""start"
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