Skip to content
ui8kit

block / commerce

Dish Showcase

Dish cards that each open the dish page; no cart.

Install

npx ui8kit add dish-showcase

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

Preview

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-showcase
blocks/dish-showcase.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 showcase of dishes: each card is one link to the dish page (picture, badge, name, weight, summary, price and
  an arrow). No cart here. Axes: cols (3, 4), ratio (4/3, 1/1), tone.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Dish, FoodLabels } from "./dish-showcase.types";

  export type DishShowcaseProps = {
    id: string;
    title: string;
    lead?: string;
    dishes: Dish[];
    empty?: string;
    labels: FoodLabels;
    cols?: "3" | "4";
    ratio?: "4/3" | "1/1";
    tone?: "default" | "muted";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Badge from "../compose/Badge.svelte";
  import Grid from "../compose/Grid.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 EmptyState from "../components/empty-state.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { fmtMoney, tpl, urlOf } from "../utils";

  let {
    id,
    title,
    lead = "",
    dishes,
    empty = "",
    labels,
    cols = "3",
    ratio = "4/3",
    tone = "default",
    landmarkLabel,
  }: DishShowcaseProps = $props();
</script>

<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
  {#if ((dishes?.length ?? 0) === 0)}
    <EmptyState icon="star" title={empty} />
  {:else}
    <Grid cols={(((cols as string) === "4") ? "2-4" : "1-3")} class="gap-8" data-slot="items">
      {#each dishes as d (d.id)}
        <Link
          href={urlOf((d.href ?? tpl("#/dish/{0}", d.id)))}
          variant="block"
          class="group flex-col items-stretch gap-4"
          data-slot="item"
        >
          <MediaFrame alt={d.name} src={d.image} ratio={ratio} />
          <Stack gap="2">
            {#if d.badge}
              <Badge variant="secondary" size="sm" class="w-fit">
                {d.badge}
              </Badge>
            {/if}
            <Group gap="2" align="baseline" justify="between">
              <Inline class="text-lg font-semibold">
                {d.name}
              </Inline>
              <Inline class="text-sm text-muted-foreground">
                {d.weight}
              </Inline>
            </Group>
            <Inline class="text-sm font-normal text-muted-foreground">
              {d.summary}
            </Inline>
            <Group gap="2" align="center" justify="between">
              <Inline class="text-base font-bold">
                {fmtMoney(d.price, d.currency)}
              </Inline>
              <Inline class="flex items-center gap-2 text-sm text-primary">
                {labels.open}
                <LucideIcon name="arrow-right" size={16} />
              </Inline>
            </Group>
          </Stack>
        </Link>
      {/each}
    </Grid>
  {/if}
</SectionFrame>
blocks/dish-showcase.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Dish = {
  id: string;
  name: string;
  summary: string;
  price: number;
  currency: string;
  weight: string;
  tag: string;
  items: string[];
  minutes: number;
  badge?: string;
  href?: string;
  image?: string;
};

export type FoodLabels = {
  add: string;
  open: string;
  order: string;
  qtyOf: string;
  decreaseOf: string;
  increaseOf: string;
  addOf: string;
  orderOf: string;
  inCart: string;
  total: string;
  minutes: string;
  ingredients: string;
  portions: string;
  size: string;
  crust: string;
  perKg: string;
  weightOf: string;
  boxFill: string;
  main: string;
  side: string;
  drink: string;
  meat: string;
  weight: string;
  sides: string;
  summary: string;
  phone: string;
  cut: string;
  heat: string;
  price: string;
  marinade: string;
  caption: string;
  pieces: string;
  strip: string;
  sections: string;
};

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-showcase
blocks/dish-showcase.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 showcase of dishes: each card is one link to the dish page (picture, badge, name, weight, summary, price and
 * an arrow). No cart here. Axes: cols (3, 4), ratio (4/3, 1/1), tone.
 */
import { type ReactNode } from "react";
import { Badge, Grid, Group, Inline, Link, Stack } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { fmtMoney, tpl, urlOf } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";

export type DishShowcaseProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  empty?: string;
  labels: FoodLabels;
  cols?: "3" | "4";
  ratio?: "4/3" | "1/1";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function DishShowcase({
  id,
  title,
  lead = "",
  dishes,
  empty = "",
  labels,
  cols = "3",
  ratio = "4/3",
  tone = "default",
  landmarkLabel,
}: DishShowcaseProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
      {((dishes?.length ?? 0) === 0) ? (
        <EmptyState icon="star" title={empty} />
      ) : (
        <Grid cols={(((cols as string) === "4") ? "2-4" : "1-3")} className="gap-8" data-slot="items">
          {(dishes ?? []).map((d) => (
            <Link key={d.id}
              href={urlOf((d.href ?? tpl("#/dish/{0}", d.id)))}
              variant="block"
              className="group flex-col items-stretch gap-4"
              data-slot="item"
            >
              <MediaFrame alt={d.name} src={d.image} ratio={ratio} />
              <Stack gap="2">
                {d.badge ? (
                  <Badge variant="secondary" size="sm" className="w-fit">
                    {d.badge}
                  </Badge>
                ) : null}
                <Group gap="2" align="baseline" justify="between">
                  <Inline className="text-lg font-semibold">
                    {d.name}
                  </Inline>
                  <Inline className="text-sm text-muted-foreground">
                    {d.weight}
                  </Inline>
                </Group>
                <Inline className="text-sm font-normal text-muted-foreground">
                  {d.summary}
                </Inline>
                <Group gap="2" align="center" justify="between">
                  <Inline className="text-base font-bold">
                    {fmtMoney(d.price, d.currency)}
                  </Inline>
                  <Inline className="flex items-center gap-2 text-sm text-primary">
                    {labels.open}
                    <LucideIcon name="arrow-right" size={16} />
                  </Inline>
                </Group>
              </Stack>
            </Link>
          ))}
        </Grid>
      )}
    </SectionFrame>
  );
}
blocks/dish-showcase.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Dish = {
  id: string;
  name: string;
  summary: string;
  price: number;
  currency: string;
  weight: string;
  tag: string;
  items: string[];
  minutes: number;
  badge?: string;
  href?: string;
  image?: string;
};

export type FoodLabels = {
  add: string;
  open: string;
  order: string;
  qtyOf: string;
  decreaseOf: string;
  increaseOf: string;
  addOf: string;
  orderOf: string;
  inCart: string;
  total: string;
  minutes: string;
  ingredients: string;
  portions: string;
  size: string;
  crust: string;
  perKg: string;
  weightOf: string;
  boxFill: string;
  main: string;
  side: string;
  drink: string;
  meat: string;
  weight: string;
  sides: string;
  summary: string;
  phone: string;
  cut: string;
  heat: string;
  price: string;
  marinade: string;
  caption: string;
  pieces: string;
  strip: string;
  sections: string;
};

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-showcase
blocks/dish-showcase.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Dish = {
  id: string;
  name: string;
  summary: string;
  price: number;
  currency: string;
  weight: string;
  tag: string;
  items: string[];
  minutes: number;
  badge?: string;
  href?: string;
  image?: string;
};

export type FoodLabels = {
  add: string;
  open: string;
  order: string;
  qtyOf: string;
  decreaseOf: string;
  increaseOf: string;
  addOf: string;
  orderOf: string;
  inCart: string;
  total: string;
  minutes: string;
  ingredients: string;
  portions: string;
  size: string;
  crust: string;
  perKg: string;
  weightOf: string;
  boxFill: string;
  main: string;
  side: string;
  drink: string;
  meat: string;
  weight: string;
  sides: string;
  summary: string;
  phone: string;
  cut: string;
  heat: string;
  price: string;
  marinade: string;
  caption: string;
  pieces: string;
  strip: string;
  sections: string;
};
blocks/dish-showcase.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 showcase of dishes: each card is one link to the dish page (picture, badge, name, weight, summary, price and
  an arrow). No cart here. Axes: cols (3, 4), ratio (4/3, 1/1), tone.
-->
<script lang="ts">
import type { Dish, FoodLabels } from "./dish-showcase.types";

export type DishShowcaseProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  empty?: string;
  labels: FoodLabels;
  cols?: "3" | "4";
  ratio?: "4/3" | "1/1";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Badge from "../compose/Badge.vue";
import Grid from "../compose/Grid.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 EmptyState from "../components/empty-state.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";
import { fmtMoney, tpl, urlOf } from "../utils";

const {
  id,
  title,
  lead = "",
  dishes,
  empty = "",
  labels,
  cols = "3",
  ratio = "4/3",
  tone = "default",
  landmarkLabel,
} = defineProps<DishShowcaseProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :lead="lead" :tone="tone" :landmarkLabel="landmarkLabel">
    <EmptyState v-if="((dishes?.length ?? 0) === 0)" icon="star" :title="empty" />
    <Grid v-else :cols="(((cols as string) === '4') ? '2-4' : '1-3')" class="gap-8" data-slot="items">
      <Link v-for="d in dishes" :key="d.id"
        :href="urlOf((d.href ?? tpl('#/dish/{0}', d.id)))"
        variant="block"
        class="group flex-col items-stretch gap-4"
        data-slot="item"
      >
        <MediaFrame :alt="d.name" :src="d.image" :ratio="ratio" />
        <Stack gap="2">
          <Badge v-if="d.badge" variant="secondary" size="sm" class="w-fit">
            {{ d.badge }}
          </Badge>
          <Group gap="2" align="baseline" justify="between">
            <Inline class="text-lg font-semibold">
              {{ d.name }}
            </Inline>
            <Inline class="text-sm text-muted-foreground">
              {{ d.weight }}
            </Inline>
          </Group>
          <Inline class="text-sm font-normal text-muted-foreground">
            {{ d.summary }}
          </Inline>
          <Group gap="2" align="center" justify="between">
            <Inline class="text-base font-bold">
              {{ fmtMoney(d.price, d.currency) }}
            </Inline>
            <Inline class="flex items-center gap-2 text-sm text-primary">
              {{ labels.open }}
              <LucideIcon name="arrow-right" :size="16" />
            </Inline>
          </Group>
        </Stack>
      </Link>
    </Grid>
  </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-showcase
blocks/dish-showcase.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 showcase of dishes: each card is one link to the dish page (picture, badge, name, weight, summary, price and
 * an arrow). No cart here. Axes: cols (3, 4), ratio (4/3, 1/1), tone.
 */
import { For, type JSX } from "solid-js";
import { Badge, Grid, Group, Inline, Link, Stack } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { fmtMoney, tpl, urlOf } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";

export type DishShowcaseProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  empty?: string;
  labels: FoodLabels;
  cols?: "3" | "4";
  ratio?: "4/3" | "1/1";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function DishShowcase({
  id,
  title,
  lead = "",
  dishes,
  empty = "",
  labels,
  cols = "3",
  ratio = "4/3",
  tone = "default",
  landmarkLabel,
}: DishShowcaseProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
      {((dishes?.length ?? 0) === 0) ? (
        <EmptyState icon="star" title={empty} />
      ) : (
        <Grid cols={(((cols as string) === "4") ? "2-4" : "1-3")} class="gap-8" data-slot="items">
          <For each={dishes ?? []}>{(d) => (
            <Link
              href={urlOf((d.href ?? tpl("#/dish/{0}", d.id)))}
              variant="block"
              class="group flex-col items-stretch gap-4"
              data-slot="item"
            >
              <MediaFrame alt={d.name} src={d.image} ratio={ratio} />
              <Stack gap="2">
                {d.badge ? (
                  <Badge variant="secondary" size="sm" class="w-fit">
                    {d.badge}
                  </Badge>
                ) : null}
                <Group gap="2" align="baseline" justify="between">
                  <Inline class="text-lg font-semibold">
                    {d.name}
                  </Inline>
                  <Inline class="text-sm text-muted-foreground">
                    {d.weight}
                  </Inline>
                </Group>
                <Inline class="text-sm font-normal text-muted-foreground">
                  {d.summary}
                </Inline>
                <Group gap="2" align="center" justify="between">
                  <Inline class="text-base font-bold">
                    {fmtMoney(d.price, d.currency)}
                  </Inline>
                  <Inline class="flex items-center gap-2 text-sm text-primary">
                    {labels.open}
                    <LucideIcon name="arrow-right" size={16} />
                  </Inline>
                </Group>
              </Stack>
            </Link>
          )}</For>
        </Grid>
      )}
    </SectionFrame>
  );
}
blocks/dish-showcase.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Dish = {
  id: string;
  name: string;
  summary: string;
  price: number;
  currency: string;
  weight: string;
  tag: string;
  items: string[];
  minutes: number;
  badge?: string;
  href?: string;
  image?: string;
};

export type FoodLabels = {
  add: string;
  open: string;
  order: string;
  qtyOf: string;
  decreaseOf: string;
  increaseOf: string;
  addOf: string;
  orderOf: string;
  inCart: string;
  total: string;
  minutes: string;
  ingredients: string;
  portions: string;
  size: string;
  crust: string;
  perKg: string;
  weightOf: string;
  boxFill: string;
  main: string;
  side: string;
  drink: string;
  meat: string;
  weight: string;
  sides: string;
  summary: string;
  phone: string;
  cut: string;
  heat: string;
  price: string;
  marinade: string;
  caption: string;
  pieces: string;
  strip: string;
  sections: string;
};

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-showcase
blocks/dish-showcase.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-showcase.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"
)

// DishShowcaseProps are the props of DishShowcase; the values are the JSON shapes of the TypeScript props.
type DishShowcaseProps 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"`
	Cols any `json:"cols"`
	Ratio any `json:"ratio"`
	Tone any `json:"tone"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A showcase of dishes: each card is one link to the dish page (picture, badge, name, weight, summary, price and an arrow). No cart here. Axes: cols (3, 4), ratio (4/3, 1/1), tone.
templ DishShowcase(p DishShowcaseProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vLead := uiutils.Def(p.Lead, "") }}
	{{ vDishes := p.Dishes }}
	{{ vEmpty := uiutils.Def(p.Empty, "") }}
	{{ vLabels := p.Labels }}
	{{ vCols := uiutils.Def(p.Cols, "3") }}
	{{ vRatio := uiutils.Def(p.Ratio, "4/3") }}
	{{ 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.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "4")), "2-4", "1-3")), BoxProps: box.BoxProps{Class: "gap-8", Attrs: uiutils.Attrs("data-slot", "items")}}) {
				for _, vD := range uiutils.L(vDishes) {
					@compose.Link(compose.LinkProps{Variant: "block", LinkProps: link.LinkProps{Href: uiutils.URL(uiutils.Coalesce(uiutils.Get(vD, "href"), uiutils.Tpl("#/dish/{0}", uiutils.Get(vD, "id"))), false), Class: "group flex-col items-stretch gap-4", Attrs: uiutils.Attrs("data-slot", "item")}}) {
						@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vD, "name"), Src: uiutils.Get(vD, "image"), Ratio: vRatio})
						@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{}}) {
							if uiutils.T(uiutils.Get(vD, "badge")) {
								@compose.Badge(compose.BadgeProps{Variant: "secondary", Size: "sm", TextProps: text.TextProps{Class: "w-fit"}}) {
									{ uiutils.Text(uiutils.Get(vD, "badge")) }
								}
							}
							@compose.Group(compose.GroupProps{Gap: "2", Align: "baseline", Justify: "between", BoxProps: box.BoxProps{}}) {
								@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-lg font-semibold"}}) {
									{ uiutils.Text(uiutils.Get(vD, "name")) }
								}
								@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-sm text-muted-foreground"}}) {
									{ uiutils.Text(uiutils.Get(vD, "weight")) }
								}
							}
							@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-sm font-normal text-muted-foreground"}}) {
								{ uiutils.Text(uiutils.Get(vD, "summary")) }
							}
							@compose.Group(compose.GroupProps{Gap: "2", Align: "center", Justify: "between", BoxProps: box.BoxProps{}}) {
								@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.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex items-center gap-2 text-sm text-primary"}}) {
									{ uiutils.Text(uiutils.Get(vLabels, "open")) }
									@icons.LucideIcon(icons.LucideIconProps{Name: "arrow-right", Size: 16})
								}
							}
						}
					}
				}
			}
		}
	}
}

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-showcase
blocks/dish-showcase.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-showcase.json
    A showcase of dishes: each card is one link to the dish page (picture, badge, name, weight, summary, price and an arrow). No cart here. Axes: cols (3, 4), ratio (4/3, 1/1), tone.
    Props (p): id, title, lead, dishes, empty, labels, cols, ratio, 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_cols = (p.cols ?? '3') -%}
{%- set v_ratio = (p.ratio ?? '4/3') -%}
{%- 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': 'star', 'title': v_empty}}, with_context = false) }}
  {%- else %}
    {%- set c_11 -%}
      {%- for v_d in og_l(v_dishes) %}
        {%- set c_10 -%}
          {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image']), 'ratio': v_ratio}}, with_context = false) }}
          {%- set c_9 -%}
            {%- if og_t(og_get(v_d, ['badge'])) %}
              {%- set c_1 -%}
                {{ og_text(og_get(v_d, ['badge'])) }}
              {%- endset -%}
              {{ include('compose/Badge.html.twig', {'variant': 'secondary', 'size': 'sm', 'class': 'w-fit', 'children': c_1}, with_context = false) }}
            {%- endif %}
            {%- set c_4 -%}
              {%- set c_2 -%}
                {{ og_text(og_get(v_d, ['name'])) }}
              {%- endset -%}
              {{ include('compose/Inline.html.twig', {'class': 'text-lg font-semibold', 'children': c_2}, with_context = false) }}
              {%- set c_3 -%}
                {{ og_text(og_get(v_d, ['weight'])) }}
              {%- endset -%}
              {{ include('compose/Inline.html.twig', {'class': 'text-sm text-muted-foreground', 'children': c_3}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'baseline', 'justify': 'between', 'children': c_4}, with_context = false) }}
            {%- set c_5 -%}
              {{ og_text(og_get(v_d, ['summary'])) }}
            {%- endset -%}
            {{ include('compose/Inline.html.twig', {'class': 'text-sm font-normal text-muted-foreground', 'children': c_5}, with_context = false) }}
            {%- set c_8 -%}
              {%- set c_6 -%}
                {{ 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_6}, with_context = false) }}
              {%- set c_7 -%}
                {{ og_text(og_get(v_labels, ['open'])) }}
                {{ include('icons/LucideIcon.html.twig', {'name': 'arrow-right', 'size': 16}, with_context = false) }}
              {%- endset -%}
              {{ include('compose/Inline.html.twig', {'class': 'flex items-center gap-2 text-sm text-primary', 'children': c_7}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'justify': 'between', 'children': c_8}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': '2', 'children': c_9}, 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': 'block', 'class': 'group flex-col items-stretch gap-4', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_10}, with_context = false) }}
      {%- endfor %}
    {%- endset -%}
    {{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_cols, '4')) ? '2-4' : '1-3')), 'class': 'gap-8', 'attrs': og_attrs(['data-slot', 'items']), '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) }}

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-showcase
blocks/dish-showcase.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-showcase.json
    A showcase of dishes: each card is one link to the dish page (picture, badge, name, weight, summary, price and an arrow). No cart here. Axes: cols (3, 4), ratio (4/3, 1/1), tone.
    Props (p): id, title, lead, dishes, empty, labels, cols, ratio, 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_cols = ($p['cols'] ?? '3')}
{var $v_ratio = ($p['ratio'] ?? '4/3')}
{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' => 'star', 'title' => $v_empty]])|noescape}
  {else}
    {capture $c_11}
      {foreach og_l($v_dishes) as $v_d}
        {capture $c_10}
          {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_d, ['name']), 'src' => og_get($v_d, ['image']), 'ratio' => $v_ratio]])|noescape}
          {capture $c_9}
            {if og_t(og_get($v_d, ['badge']))}
              {capture $c_1}
                {=og_text(og_get($v_d, ['badge']))}
              {/capture}
              {=og_include('compose/Badge.latte', ['variant' => 'secondary', 'size' => 'sm', 'class' => 'w-fit', 'children' => (string) $c_1])|noescape}
            {/if}
            {capture $c_4}
              {capture $c_2}
                {=og_text(og_get($v_d, ['name']))}
              {/capture}
              {=og_include('compose/Inline.latte', ['class' => 'text-lg font-semibold', 'children' => (string) $c_2])|noescape}
              {capture $c_3}
                {=og_text(og_get($v_d, ['weight']))}
              {/capture}
              {=og_include('compose/Inline.latte', ['class' => 'text-sm text-muted-foreground', 'children' => (string) $c_3])|noescape}
            {/capture}
            {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'baseline', 'justify' => 'between', 'children' => (string) $c_4])|noescape}
            {capture $c_5}
              {=og_text(og_get($v_d, ['summary']))}
            {/capture}
            {=og_include('compose/Inline.latte', ['class' => 'text-sm font-normal text-muted-foreground', 'children' => (string) $c_5])|noescape}
            {capture $c_8}
              {capture $c_6}
                {=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_6])|noescape}
              {capture $c_7}
                {=og_text(og_get($v_labels, ['open']))}
                {=og_include('icons/LucideIcon.latte', ['name' => 'arrow-right', 'size' => 16])|noescape}
              {/capture}
              {=og_include('compose/Inline.latte', ['class' => 'flex items-center gap-2 text-sm text-primary', 'children' => (string) $c_7])|noescape}
            {/capture}
            {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'justify' => 'between', 'children' => (string) $c_8])|noescape}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => '2', 'children' => (string) $c_9])|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' => 'block', 'class' => 'group flex-col items-stretch gap-4', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_10])|noescape}
      {/foreach}
    {/capture}
    {=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_cols, '4')) ? '2-4' : '1-3')), 'class' => 'gap-8', 'attrs' => og_attrs(['data-slot', 'items']), '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}

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-showcase
blocks/dish-showcase.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-showcase.json
    A showcase of dishes: each card is one link to the dish page (picture, badge, name, weight, summary, price and an arrow). No cart here. Axes: cols (3, 4), ratio (4/3, 1/1), tone.
    Props (p): id, title, lead, dishes, empty, labels, cols, ratio, 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_cols = og_def(p['cols'], '3') -%}
{%- set v_ratio = og_def(p['ratio'], '4/3') -%}
{%- 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': 'star', 'title': v_empty}}) }}
  {%- else %}
    {%- set c_11 -%}
      {%- for v_d in og_l(v_dishes) %}
        {%- set c_10 -%}
          {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image']), 'ratio': v_ratio}}) }}
          {%- set c_9 -%}
            {%- if og_t(og_get(v_d, ['badge'])) %}
              {%- set c_1 -%}
                {{ og_text(og_get(v_d, ['badge'])) }}
              {%- endset -%}
              {{ og_include('compose/badge.html.j2', {'p': {'Variant': 'secondary', 'Size': 'sm', 'Class': 'w-fit'}, 'children': c_1}) }}
            {%- endif %}
            {%- set c_4 -%}
              {%- set c_2 -%}
                {{ og_text(og_get(v_d, ['name'])) }}
              {%- endset -%}
              {{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-lg font-semibold'}, 'children': c_2}) }}
              {%- set c_3 -%}
                {{ og_text(og_get(v_d, ['weight'])) }}
              {%- endset -%}
              {{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-sm text-muted-foreground'}, 'children': c_3}) }}
            {%- endset -%}
            {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'baseline', 'Justify': 'between'}, 'children': c_4}) }}
            {%- set c_5 -%}
              {{ og_text(og_get(v_d, ['summary'])) }}
            {%- endset -%}
            {{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-sm font-normal text-muted-foreground'}, 'children': c_5}) }}
            {%- set c_8 -%}
              {%- set c_6 -%}
                {{ 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_6}) }}
              {%- set c_7 -%}
                {{ og_text(og_get(v_labels, ['open'])) }}
                {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'arrow-right', 'Size': 16}}) }}
              {%- endset -%}
              {{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex items-center gap-2 text-sm text-primary'}, 'children': c_7}) }}
            {%- endset -%}
            {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Justify': 'between'}, 'children': c_8}) }}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2'}, 'children': c_9}) }}
        {%- 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': 'block', 'Class': 'group flex-col items-stretch gap-4', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_10}) }}
      {%- endfor %}
    {%- endset -%}
    {{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('2-4' if og_t(og_eq(v_cols, '4')) else '1-3')), 'Class': 'gap-8', 'Attrs': og_attrs(['data-slot', 'items'])}, '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)}) }}

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 showcase of dishes: each card is one link to the dish page (picture, badge, name, weight, summary, price and an arrow). No cart here. Axes: cols (3, 4), ratio (4/3, 1/1), tone.

Props of DishShowcase
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-
cols "3" | "4""3"
ratio "4/3" | "1/1""4/3"
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

Used in