Skip to content
ui8kit

block / commerce

Menu Board

Category sections with DishCards in a grid, or denser menu rows; prices can be hidden.

Install

npx ui8kit add menu-board

Pulls in: box, compose, dish-card, dish-showcase, empty-state, grid, kit-box, kit-text, list, menu-row, menu-section-nav, restaurant-menu, section-frame, stack, text, title, utils

Preview

What the kitchen is cooking.

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 menu-board
blocks/menu-board.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 restaurant menu board: category sections with DishCards in a grid, or denser menu rows in a list or a
  sectioned column. Axes: layout (sections, grid, list), prices (show, hide), density. Composes DishCard;
  section rows use MenuRow.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Dish, FoodLabels } from "./dish-showcase.types";
  import type { DishSection } from "./restaurant-menu.types";

  export type MenuBoardProps = {
    id: string;
    title: string;
    lead?: string;
    dishes: Dish[];
    sections: DishSection[];
    empty?: string;
    labels: FoodLabels;
    layout?: "sections" | "grid" | "list";
    prices?: "show" | "hide";
    density?: "default" | "compact";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Grid from "../compose/Grid.svelte";
  import List from "../compose/List.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import Title from "../compose/Title.svelte";
  import DishCard from "../blocks/dish-card.svelte";
  import EmptyState from "../components/empty-state.svelte";
  import MenuRow from "../components/menu-row.svelte";
  import MenuSectionNav from "../components/menu-section-nav.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { tpl } from "../utils";

  let {
    id,
    title,
    lead = "",
    dishes,
    sections,
    empty = "",
    labels,
    layout = "sections",
    prices = "show",
    density = "default",
    landmarkLabel,
  }: MenuBoardProps = $props();
</script>

<SectionFrame id={id} title={title} lead={lead} density={density} landmarkLabel={landmarkLabel}>
  {#if ((sections?.length ?? 0) === 0)}
    <EmptyState icon="star" title={empty} />
  {:else}
    <Stack gap="8" align="stretch">
      {#if ((layout as string) === "sections")}
        <MenuSectionNav label={labels.sections} sections={sections} prefix={id} landmarkLabel={landmarkLabel} />
      {/if}
      <Box class="flex flex-col gap-8" data-slot="items">
        {#each sections as s (s.id)}
          <Stack
            gap={(((density as string) === "compact") ? "2" : "4")}
            id={tpl("{0}-{1}", id, s.key)}
            data-slot="menusection"
          >
            <Stack gap="0" class="border-b border-border pb-2">
              <Title as={3} size="xl" weight="bold">
                {s.title}
              </Title>
              <Text size="sm" class="text-muted-foreground">
                {s.note}
              </Text>
            </Stack>
            {#if ((layout as string) === "grid")}
              <Grid cols="1-3" class="gap-4">
                {#each dishes as d (d.id)}
                  {#if (d.tag === s.key)}
                    <DishCard
                      dish={d}
                      labels={{ add: labels.add }}
                      media={(((density as string) === "compact") ? "none" : "image")}
                      prices={prices}
                      action="none"
                      density={density}
                    />
                  {/if}
                {/each}
              </Grid>
            {:else}
              <List tag="ul" class="flex flex-col">
                {#each dishes as d (d.id)}
                  {#if (d.tag === s.key)}
                    <MenuRow dish={d} prices={prices} />
                  {/if}
                {/each}
              </List>
            {/if}
          </Stack>
        {/each}
      </Box>
    </Stack>
  {/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 menu-board
blocks/menu-board.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 restaurant menu board: category sections with DishCards in a grid, or denser menu rows in a list or a
 * sectioned column. Axes: layout (sections, grid, list), prices (show, hide), density. Composes DishCard;
 * section rows use MenuRow.
 */
import { Fragment, type ReactNode } from "react";
import { Box, Grid, List, Stack, Text, Title } from "../compose";
import { DishCard } from "../blocks/dish-card";
import { EmptyState } from "../components/empty-state";
import { MenuRow } from "../components/menu-row";
import { MenuSectionNav } from "../components/menu-section-nav";
import { SectionFrame } from "../components/section-frame";
import { tpl } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishSection } from "./restaurant-menu.types";

export type MenuBoardProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  sections: DishSection[];
  empty?: string;
  labels: FoodLabels;
  layout?: "sections" | "grid" | "list";
  prices?: "show" | "hide";
  density?: "default" | "compact";
  landmarkLabel?: string;
};

export function MenuBoard({
  id,
  title,
  lead = "",
  dishes,
  sections,
  empty = "",
  labels,
  layout = "sections",
  prices = "show",
  density = "default",
  landmarkLabel,
}: MenuBoardProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} density={density} landmarkLabel={landmarkLabel}>
      {((sections?.length ?? 0) === 0) ? (
        <EmptyState icon="star" title={empty} />
      ) : (
        <Stack gap="8" align="stretch">
          {((layout as string) === "sections") ? (
            <MenuSectionNav label={labels.sections} sections={sections} prefix={id} landmarkLabel={landmarkLabel} />
          ) : null}
          <Box className="flex flex-col gap-8" data-slot="items">
            {(sections ?? []).map((s) => (
              <Stack key={s.id}
                gap={(((density as string) === "compact") ? "2" : "4")}
                id={tpl("{0}-{1}", id, s.key)}
                data-slot="menusection"
              >
                <Stack gap="0" className="border-b border-border pb-2">
                  <Title as={3} size="xl" weight="bold">
                    {s.title}
                  </Title>
                  <Text size="sm" className="text-muted-foreground">
                    {s.note}
                  </Text>
                </Stack>
                {((layout as string) === "grid") ? (
                  <Grid cols="1-3" className="gap-4">
                    {(dishes ?? []).map((d) => (
                      <Fragment key={d.id}>
                        {(d.tag === s.key) ? (
                          <DishCard
                            dish={d}
                            labels={{ add: labels.add }}
                            media={(((density as string) === "compact") ? "none" : "image")}
                            prices={prices}
                            action="none"
                            density={density}
                          />
                        ) : null}
                      </Fragment>
                    ))}
                  </Grid>
                ) : (
                  <List tag="ul" className="flex flex-col">
                    {(dishes ?? []).map((d) => (
                      <Fragment key={d.id}>
                        {(d.tag === s.key) ? (
                          <MenuRow dish={d} prices={prices} />
                        ) : null}
                      </Fragment>
                    ))}
                  </List>
                )}
              </Stack>
            ))}
          </Box>
        </Stack>
      )}
    </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 menu-board
blocks/menu-board.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 restaurant menu board: category sections with DishCards in a grid, or denser menu rows in a list or a
  sectioned column. Axes: layout (sections, grid, list), prices (show, hide), density. Composes DishCard;
  section rows use MenuRow.
-->
<script lang="ts">
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishSection } from "./restaurant-menu.types";

export type MenuBoardProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  sections: DishSection[];
  empty?: string;
  labels: FoodLabels;
  layout?: "sections" | "grid" | "list";
  prices?: "show" | "hide";
  density?: "default" | "compact";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Grid from "../compose/Grid.vue";
import List from "../compose/List.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import DishCard from "../blocks/dish-card.vue";
import EmptyState from "../components/empty-state.vue";
import MenuRow from "../components/menu-row.vue";
import MenuSectionNav from "../components/menu-section-nav.vue";
import SectionFrame from "../components/section-frame.vue";
import { tpl } from "../utils";

const {
  id,
  title,
  lead = "",
  dishes,
  sections,
  empty = "",
  labels,
  layout = "sections",
  prices = "show",
  density = "default",
  landmarkLabel,
} = defineProps<MenuBoardProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :lead="lead" :density="density" :landmarkLabel="landmarkLabel">
    <EmptyState v-if="((sections?.length ?? 0) === 0)" icon="star" :title="empty" />
    <Stack v-else gap="8" align="stretch">
      <MenuSectionNav
        v-if="((layout as string) === 'sections')"
        :label="labels.sections"
        :sections="sections"
        :prefix="id"
        :landmarkLabel="landmarkLabel"
      />
      <Box class="flex flex-col gap-8" data-slot="items">
        <Stack v-for="s in sections" :key="s.id"
          :gap="(((density as string) === 'compact') ? '2' : '4')"
          :id="tpl('{0}-{1}', id, s.key)"
          data-slot="menusection"
        >
          <Stack gap="0" class="border-b border-border pb-2">
            <Title :as="3" size="xl" weight="bold">
              {{ s.title }}
            </Title>
            <Text size="sm" class="text-muted-foreground">
              {{ s.note }}
            </Text>
          </Stack>
          <Grid v-if="((layout as string) === 'grid')" cols="1-3" class="gap-4">
            <template v-for="d in dishes" :key="d.id">
              <DishCard v-if="(d.tag === s.key)"
                :dish="d"
                :labels="{ add: labels.add }"
                :media="(((density as string) === 'compact') ? 'none' : 'image')"
                :prices="prices"
                action="none"
                :density="density"
              />
            </template>
          </Grid>
          <List v-else tag="ul" class="flex flex-col">
            <template v-for="d in dishes" :key="d.id">
              <MenuRow v-if="(d.tag === s.key)" :dish="d" :prices="prices" />
            </template>
          </List>
        </Stack>
      </Box>
    </Stack>
  </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 menu-board
blocks/menu-board.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 restaurant menu board: category sections with DishCards in a grid, or denser menu rows in a list or a
 * sectioned column. Axes: layout (sections, grid, list), prices (show, hide), density. Composes DishCard;
 * section rows use MenuRow.
 */
import { For, type JSX } from "solid-js";
import { Box, Grid, List, Stack, Text, Title } from "../compose";
import { DishCard } from "../blocks/dish-card";
import { EmptyState } from "../components/empty-state";
import { MenuRow } from "../components/menu-row";
import { MenuSectionNav } from "../components/menu-section-nav";
import { SectionFrame } from "../components/section-frame";
import { tpl } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishSection } from "./restaurant-menu.types";

export type MenuBoardProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  sections: DishSection[];
  empty?: string;
  labels: FoodLabels;
  layout?: "sections" | "grid" | "list";
  prices?: "show" | "hide";
  density?: "default" | "compact";
  landmarkLabel?: string;
};

export function MenuBoard({
  id,
  title,
  lead = "",
  dishes,
  sections,
  empty = "",
  labels,
  layout = "sections",
  prices = "show",
  density = "default",
  landmarkLabel,
}: MenuBoardProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} density={density} landmarkLabel={landmarkLabel}>
      {((sections?.length ?? 0) === 0) ? (
        <EmptyState icon="star" title={empty} />
      ) : (
        <Stack gap="8" align="stretch">
          {((layout as string) === "sections") ? (
            <MenuSectionNav label={labels.sections} sections={sections} prefix={id} landmarkLabel={landmarkLabel} />
          ) : null}
          <Box class="flex flex-col gap-8" data-slot="items">
            <For each={sections ?? []}>{(s) => (
              <Stack
                gap={(((density as string) === "compact") ? "2" : "4")}
                id={tpl("{0}-{1}", id, s.key)}
                data-slot="menusection"
              >
                <Stack gap="0" class="border-b border-border pb-2">
                  <Title as={3} size="xl" weight="bold">
                    {s.title}
                  </Title>
                  <Text size="sm" class="text-muted-foreground">
                    {s.note}
                  </Text>
                </Stack>
                {((layout as string) === "grid") ? (
                  <Grid cols="1-3" class="gap-4">
                    <For each={dishes ?? []}>{(d) => (
                      <>
                        {(d.tag === s.key) ? (
                          <DishCard
                            dish={d}
                            labels={{ add: labels.add }}
                            media={(((density as string) === "compact") ? "none" : "image")}
                            prices={prices}
                            action="none"
                            density={density}
                          />
                        ) : null}
                      </>
                    )}</For>
                  </Grid>
                ) : (
                  <List tag="ul" class="flex flex-col">
                    <For each={dishes ?? []}>{(d) => (
                      <>
                        {(d.tag === s.key) ? (
                          <MenuRow dish={d} prices={prices} />
                        ) : null}
                      </>
                    )}</For>
                  </List>
                )}
              </Stack>
            )}</For>
          </Box>
        </Stack>
      )}
    </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 menu-board
blocks/menu-board.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/menu-board.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// MenuBoardProps are the props of MenuBoard; the values are the JSON shapes of the TypeScript props.
type MenuBoardProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Lead any `json:"lead"`
	Dishes any `json:"dishes"`
	Sections any `json:"sections"`
	Empty any `json:"empty"`
	Labels any `json:"labels"`
	Layout any `json:"layout"`
	Prices any `json:"prices"`
	Density any `json:"density"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A restaurant menu board: category sections with DishCards in a grid, or denser menu rows in a list or a sectioned column. Axes: layout (sections, grid, list), prices (show, hide), density. Composes DishCard; section rows use MenuRow.
templ MenuBoard(p MenuBoardProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vLead := uiutils.Def(p.Lead, "") }}
	{{ vDishes := p.Dishes }}
	{{ vSections := p.Sections }}
	{{ vEmpty := uiutils.Def(p.Empty, "") }}
	{{ vLabels := p.Labels }}
	{{ vLayout := uiutils.Def(p.Layout, "sections") }}
	{{ vPrices := uiutils.Def(p.Prices, "show") }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vLead, Density: vDensity, LandmarkLabel: vLandmarkLabel}) {
		if uiutils.Eq(uiutils.Len(vSections), float64(0)) {
			@EmptyState(EmptyStateProps{Icon: "star", Title: vEmpty})
		} else {
			@compose.Stack(compose.StackProps{Gap: "8", Align: "stretch", BoxProps: box.BoxProps{}}) {
				if uiutils.Eq(vLayout, "sections") {
					@MenuSectionNav(MenuSectionNavProps{Label: uiutils.Get(vLabels, "sections"), Sections: vSections, Prefix: vId, LandmarkLabel: vLandmarkLabel})
				}
				@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "flex flex-col gap-8", Attrs: uiutils.Attrs("data-slot", "items")}}) {
					for _, vS := range uiutils.L(vSections) {
						@compose.Stack(compose.StackProps{Gap: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "2", "4")), BoxProps: box.BoxProps{Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-{1}", vId, uiutils.Get(vS, "key")), "data-slot", "menusection")}}) {
							@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{Class: "border-b border-border pb-2"}}) {
								@compose.Title(compose.TitleProps{As: "3", Size: "xl", Weight: "bold", TextProps: text.TextProps{}}) {
									{ uiutils.Text(uiutils.Get(vS, "title")) }
								}
								@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
									{ uiutils.Text(uiutils.Get(vS, "note")) }
								}
							}
							if uiutils.Eq(vLayout, "grid") {
								@compose.Grid(compose.GridProps{Cols: "1-3", BoxProps: box.BoxProps{Class: "gap-4"}}) {
									for _, vD := range uiutils.L(vDishes) {
										if uiutils.T(uiutils.Eq(uiutils.Get(vD, "tag"), uiutils.Get(vS, "key"))) {
											@DishCard(DishCardProps{Dish: vD, Labels: map[string]any{"add": uiutils.Get(vLabels, "add")}, Media: uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "none", "image"), Prices: vPrices, Action: "none", Density: vDensity})
										}
									}
								}
							} else {
								@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ul", Class: "flex flex-col"}}) {
									for _, vD := range uiutils.L(vDishes) {
										if uiutils.T(uiutils.Eq(uiutils.Get(vD, "tag"), uiutils.Get(vS, "key"))) {
											@MenuRow(MenuRowProps{Dish: vD, Prices: vPrices})
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

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 menu-board
blocks/menu-board.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/menu-board.json
    A restaurant menu board: category sections with DishCards in a grid, or denser menu rows in a list or a sectioned column. Axes: layout (sections, grid, list), prices (show, hide), density. Composes DishCard; section rows use MenuRow.
    Props (p): id, title, lead, dishes, sections, empty, labels, layout, prices, density, 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_sections = (p.sections ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'sections') -%}
{%- set v_prices = (p.prices ?? 'show') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_9 -%}
  {%- if og_t(og_eq(og_len(v_sections), 0)) %}
    {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'star', 'title': v_empty}}, with_context = false) }}
  {%- else %}
    {%- set c_8 -%}
      {%- if og_t(og_eq(v_layout, 'sections')) %}
        {{ include('blocks/menu-section-nav.html.twig', {'p': {'label': og_get(v_labels, ['sections']), 'sections': v_sections, 'prefix': v_id, 'landmarkLabel': v_landmarkLabel}}, with_context = false) }}
      {%- endif %}
      {%- set c_7 -%}
        {%- for v_s in og_l(v_sections) %}
          {%- set c_6 -%}
            {%- set c_3 -%}
              {%- set c_1 -%}
                {{ og_text(og_get(v_s, ['title'])) }}
              {%- endset -%}
              {{ include('compose/Title.html.twig', {'as': 3, 'size': 'xl', 'weight': 'bold', 'children': c_1}, with_context = false) }}
              {%- set c_2 -%}
                {{ og_text(og_get(v_s, ['note'])) }}
              {%- endset -%}
              {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Stack.html.twig', {'gap': '0', 'class': 'border-b border-border pb-2', 'children': c_3}, with_context = false) }}
            {%- if og_t(og_eq(v_layout, 'grid')) %}
              {%- set c_4 -%}
                {%- for v_d in og_l(v_dishes) %}
                  {%- if og_t(og_eq(og_get(v_d, ['tag']), og_get(v_s, ['key']))) %}
                    {{ include('blocks/dish-card.html.twig', {'p': {'dish': v_d, 'labels': {'add': og_get(v_labels, ['add'])}, 'media': (og_t(og_eq(v_density, 'compact')) ? 'none' : 'image'), 'prices': v_prices, 'action': 'none', 'density': v_density}}, with_context = false) }}
                  {%- endif %}
                {%- endfor %}
              {%- endset -%}
              {{ include('compose/Grid.html.twig', {'cols': '1-3', 'class': 'gap-4', 'children': c_4}, with_context = false) }}
            {%- else %}
              {%- set c_5 -%}
                {%- for v_d in og_l(v_dishes) %}
                  {%- if og_t(og_eq(og_get(v_d, ['tag']), og_get(v_s, ['key']))) %}
                    {{ include('blocks/menu-row.html.twig', {'p': {'dish': v_d, 'prices': v_prices}}, with_context = false) }}
                  {%- endif %}
                {%- endfor %}
              {%- endset -%}
              {{ include('compose/List.html.twig', {'tag': 'ul', 'class': 'flex flex-col', 'children': c_5}, with_context = false) }}
            {%- endif %}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': og_s((og_t(og_eq(v_density, 'compact')) ? '2' : '4')), 'attrs': og_attrs(['id', og_tpl('{0}-{1}', [v_id, og_get(v_s, ['key'])]), 'data-slot', 'menusection']), 'children': c_6}, with_context = false) }}
        {%- endfor %}
      {%- endset -%}
      {{ include('compose/Box.html.twig', {'class': 'flex flex-col gap-8', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_7}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Stack.html.twig', {'gap': '8', 'align': 'stretch', 'children': c_8}, with_context = false) }}
  {%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'density': v_density, '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 menu-board
blocks/menu-board.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/menu-board.json
    A restaurant menu board: category sections with DishCards in a grid, or denser menu rows in a list or a sectioned column. Axes: layout (sections, grid, list), prices (show, hide), density. Composes DishCard; section rows use MenuRow.
    Props (p): id, title, lead, dishes, sections, empty, labels, layout, prices, density, 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_sections = ($p['sections'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'sections')}
{var $v_prices = ($p['prices'] ?? 'show')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_9}
  {if og_t(og_eq(og_len($v_sections), 0))}
    {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'star', 'title' => $v_empty]])|noescape}
  {else}
    {capture $c_8}
      {if og_t(og_eq($v_layout, 'sections'))}
        {=og_include('blocks/menu-section-nav.latte', ['p' => ['label' => og_get($v_labels, ['sections']), 'sections' => $v_sections, 'prefix' => $v_id, 'landmarkLabel' => $v_landmarkLabel]])|noescape}
      {/if}
      {capture $c_7}
        {foreach og_l($v_sections) as $v_s}
          {capture $c_6}
            {capture $c_3}
              {capture $c_1}
                {=og_text(og_get($v_s, ['title']))}
              {/capture}
              {=og_include('compose/Title.latte', ['as' => 3, 'size' => 'xl', 'weight' => 'bold', 'children' => (string) $c_1])|noescape}
              {capture $c_2}
                {=og_text(og_get($v_s, ['note']))}
              {/capture}
              {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
            {/capture}
            {=og_include('compose/Stack.latte', ['gap' => '0', 'class' => 'border-b border-border pb-2', 'children' => (string) $c_3])|noescape}
            {if og_t(og_eq($v_layout, 'grid'))}
              {capture $c_4}
                {foreach og_l($v_dishes) as $v_d}
                  {if og_t(og_eq(og_get($v_d, ['tag']), og_get($v_s, ['key'])))}
                    {=og_include('blocks/dish-card.latte', ['p' => ['dish' => $v_d, 'labels' => ['add' => og_get($v_labels, ['add'])], 'media' => (og_t(og_eq($v_density, 'compact')) ? 'none' : 'image'), 'prices' => $v_prices, 'action' => 'none', 'density' => $v_density]])|noescape}
                  {/if}
                {/foreach}
              {/capture}
              {=og_include('compose/Grid.latte', ['cols' => '1-3', 'class' => 'gap-4', 'children' => (string) $c_4])|noescape}
            {else}
              {capture $c_5}
                {foreach og_l($v_dishes) as $v_d}
                  {if og_t(og_eq(og_get($v_d, ['tag']), og_get($v_s, ['key'])))}
                    {=og_include('blocks/menu-row.latte', ['p' => ['dish' => $v_d, 'prices' => $v_prices]])|noescape}
                  {/if}
                {/foreach}
              {/capture}
              {=og_include('compose/List.latte', ['tag' => 'ul', 'class' => 'flex flex-col', 'children' => (string) $c_5])|noescape}
            {/if}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => og_s((og_t(og_eq($v_density, 'compact')) ? '2' : '4')), 'attrs' => og_attrs(['id', og_tpl('{0}-{1}', [$v_id, og_get($v_s, ['key'])]), 'data-slot', 'menusection']), 'children' => (string) $c_6])|noescape}
        {/foreach}
      {/capture}
      {=og_include('compose/Box.latte', ['class' => 'flex flex-col gap-8', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_7])|noescape}
    {/capture}
    {=og_include('compose/Stack.latte', ['gap' => '8', 'align' => 'stretch', 'children' => (string) $c_8])|noescape}
  {/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_lead, 'density' => $v_density, '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 menu-board
blocks/menu-board.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/menu-board.json
    A restaurant menu board: category sections with DishCards in a grid, or denser menu rows in a list or a sectioned column. Axes: layout (sections, grid, list), prices (show, hide), density. Composes DishCard; section rows use MenuRow.
    Props (p): id, title, lead, dishes, sections, empty, labels, layout, prices, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_lead = og_def(p['lead'], '') -%}
{%- set v_dishes = og_def(p['dishes'], none) -%}
{%- set v_sections = og_def(p['sections'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'sections') -%}
{%- set v_prices = og_def(p['prices'], 'show') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_9 -%}
  {%- if og_t(og_eq(og_len(v_sections), 0)) %}
    {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'star', 'title': v_empty}}) }}
  {%- else %}
    {%- set c_8 -%}
      {%- if og_t(og_eq(v_layout, 'sections')) %}
        {{ og_include('blocks/menu-section-nav.html.j2', {'p': {'label': og_get(v_labels, ['sections']), 'sections': v_sections, 'prefix': v_id, 'landmarkLabel': v_landmarkLabel}}) }}
      {%- endif %}
      {%- set c_7 -%}
        {%- for v_s in og_l(v_sections) %}
          {%- set c_6 -%}
            {%- set c_3 -%}
              {%- set c_1 -%}
                {{ og_text(og_get(v_s, ['title'])) }}
              {%- endset -%}
              {{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'xl', 'Weight': 'bold'}, 'children': c_1}) }}
              {%- set c_2 -%}
                {{ og_text(og_get(v_s, ['note'])) }}
              {%- endset -%}
              {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
            {%- endset -%}
            {{ og_include('compose/stack.html.j2', {'p': {'Gap': '0', 'Class': 'border-b border-border pb-2'}, 'children': c_3}) }}
            {%- if og_t(og_eq(v_layout, 'grid')) %}
              {%- set c_4 -%}
                {%- for v_d in og_l(v_dishes) %}
                  {%- if og_t(og_eq(og_get(v_d, ['tag']), og_get(v_s, ['key']))) %}
                    {{ og_include('blocks/dish-card.html.j2', {'p': {'dish': v_d, 'labels': {'add': og_get(v_labels, ['add'])}, 'media': ('none' if og_t(og_eq(v_density, 'compact')) else 'image'), 'prices': v_prices, 'action': 'none', 'density': v_density}}) }}
                  {%- endif %}
                {%- endfor %}
              {%- endset -%}
              {{ og_include('compose/grid.html.j2', {'p': {'Cols': '1-3', 'Class': 'gap-4'}, 'children': c_4}) }}
            {%- else %}
              {%- set c_5 -%}
                {%- for v_d in og_l(v_dishes) %}
                  {%- if og_t(og_eq(og_get(v_d, ['tag']), og_get(v_s, ['key']))) %}
                    {{ og_include('blocks/menu-row.html.j2', {'p': {'dish': v_d, 'prices': v_prices}}) }}
                  {%- endif %}
                {%- endfor %}
              {%- endset -%}
              {{ og_include('compose/list.html.j2', {'p': {'Tag': 'ul', 'Class': 'flex flex-col'}, 'children': c_5}) }}
            {%- endif %}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': og_s(('2' if og_t(og_eq(v_density, 'compact')) else '4')), 'Attrs': og_attrs(['id', og_tpl('{0}-{1}', [v_id, og_get(v_s, ['key'])]), 'data-slot', 'menusection'])}, 'children': c_6}) }}
        {%- endfor %}
      {%- endset -%}
      {{ og_include('compose/box.html.j2', {'p': {'Class': 'flex flex-col gap-8', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_7}) }}
    {%- endset -%}
    {{ og_include('compose/stack.html.j2', {'p': {'Gap': '8', 'Align': 'stretch'}, 'children': c_8}) }}
  {%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'density': v_density, '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 restaurant menu board: category sections with DishCards in a grid, or denser menu rows in a list or a sectioned column. Axes: layout (sections, grid, list), prices (show, hide), density. Composes DishCard; section rows use MenuRow.

Props of MenuBoard
PropTypeDefault Description
id (required)string-
title (required)string-
lead string""
dishes (required)Dish[]-
sections (required)DishSection[]-
empty string""the text of the empty state (no records), from the dictionary
labels (required)FoodLabels-
layout "sections" | "grid" | "list""sections"
prices "show" | "hide""show"
density "default" | "compact""default"
landmarkLabel string-accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one