Skip to content
ui8kit

block / commerce

Dish Strip

A horizontal strip of small cards that scrolls sideways.

Install

npx ui8kit add dish-strip

Pulls in: add-icon, compose, dish-showcase, empty-state, group, inline, kit-box, kit-text, list, list-item, media-frame, section-frame, text, utils

Preview

Rolls

Swipe for more rolls.

  • Salmon roll

    8 pcs

    $7.90
  • Avocado roll

    8 pcs

    $5.90
  • Spicy tuna roll

    8 pcs

    $8.50
  • Crab roll

    8 pcs

    $6.90
  • Eel roll

    8 pcs

    $9.50
  • Veggie roll

    8 pcs

    $5.50

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-strip
blocks/dish-strip.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 horizontal strip of dishes that scrolls sideways (a focusable, named region with snap points): small cards
  with a picture, name, weight, price and an add button. Axes: size (sm, lg), tone.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Dish, FoodLabels } from "./dish-showcase.types";

  export type DishStripProps = {
    id: string;
    title: string;
    lead?: string;
    dishes: Dish[];
    empty?: string;
    labels: FoodLabels;
    size?: "sm" | "lg";
    tone?: "default" | "muted";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Group from "../compose/Group.svelte";
  import Inline from "../compose/Inline.svelte";
  import List from "../compose/List.svelte";
  import ListItem from "../compose/ListItem.svelte";
  import Text from "../compose/Text.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 { fmtMoney, tpl } from "../utils";

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

<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
  {#if ((dishes?.length ?? 0) === 0)}
    <EmptyState icon="star" title={empty} />
  {:else}
    <List
      tag="ul"
      class="-mx-4 flex snap-x gap-4 overflow-x-auto px-4 pb-4"
      tabindex={0}
      aria-label={labels.strip}
      data-slot="items"
    >
      {#each dishes as d (d.id)}
        <ListItem
          class={
            (size as string) === "lg" ? "flex w-64 shrink-0 snap-start flex-col gap-2"
            : "flex w-48 shrink-0 snap-start flex-col gap-2"
          }
          data-slot="item"
        >
          <MediaFrame alt={d.name} src={d.image} ratio={(((size as string) === "lg") ? "4/3" : "1/1")} />
          <Group gap="2" align="baseline" justify="between">
            <Text size="sm" weight="semibold">
              {d.name}
            </Text>
            <Text size="xs" class="text-muted-foreground">
              {d.weight}
            </Text>
          </Group>
          <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>
        </ListItem>
      {/each}
    </List>
  {/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-strip
blocks/dish-strip.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 horizontal strip of dishes that scrolls sideways (a focusable, named region with snap points): small cards
 * with a picture, name, weight, price and an add button. Axes: size (sm, lg), tone.
 */
import { type ReactNode } from "react";
import { Group, Inline, List, ListItem, Text } from "../compose";
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 { fmtMoney, tpl } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";

export type DishStripProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  empty?: string;
  labels: FoodLabels;
  size?: "sm" | "lg";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function DishStrip({
  id,
  title,
  lead = "",
  dishes,
  empty = "",
  labels,
  size = "sm",
  tone = "default",
  landmarkLabel,
}: DishStripProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
      {((dishes?.length ?? 0) === 0) ? (
        <EmptyState icon="star" title={empty} />
      ) : (
        <List
          tag="ul"
          className="-mx-4 flex snap-x gap-4 overflow-x-auto px-4 pb-4"
          tabIndex={0}
          aria-label={labels.strip}
          data-slot="items"
        >
          {(dishes ?? []).map((d) => (
            <ListItem key={d.id}
              className={
                (size as string) === "lg" ? "flex w-64 shrink-0 snap-start flex-col gap-2"
                : "flex w-48 shrink-0 snap-start flex-col gap-2"
              }
              data-slot="item"
            >
              <MediaFrame alt={d.name} src={d.image} ratio={(((size as string) === "lg") ? "4/3" : "1/1")} />
              <Group gap="2" align="baseline" justify="between">
                <Text size="sm" weight="semibold">
                  {d.name}
                </Text>
                <Text size="xs" className="text-muted-foreground">
                  {d.weight}
                </Text>
              </Group>
              <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>
            </ListItem>
          ))}
        </List>
      )}
    </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-strip
blocks/dish-strip.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 horizontal strip of dishes that scrolls sideways (a focusable, named region with snap points): small cards
  with a picture, name, weight, price and an add button. Axes: size (sm, lg), tone.
-->
<script lang="ts">
import type { Dish, FoodLabels } from "./dish-showcase.types";

export type DishStripProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  empty?: string;
  labels: FoodLabels;
  size?: "sm" | "lg";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import Text from "../compose/Text.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 { fmtMoney, tpl } from "../utils";

const {
  id,
  title,
  lead = "",
  dishes,
  empty = "",
  labels,
  size = "sm",
  tone = "default",
  landmarkLabel,
} = defineProps<DishStripProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :lead="lead" :tone="tone" :landmarkLabel="landmarkLabel">
    <EmptyState v-if="((dishes?.length ?? 0) === 0)" icon="star" :title="empty" />
    <List v-else
      tag="ul"
      class="-mx-4 flex snap-x gap-4 overflow-x-auto px-4 pb-4"
      :tabindex="0"
      :aria-label="labels.strip"
      data-slot="items"
    >
      <ListItem v-for="d in dishes" :key="d.id"
        :class="
          (size as string) === 'lg' ? 'flex w-64 shrink-0 snap-start flex-col gap-2'
          : 'flex w-48 shrink-0 snap-start flex-col gap-2'
        "
        data-slot="item"
      >
        <MediaFrame :alt="d.name" :src="d.image" :ratio="(((size as string) === 'lg') ? '4/3' : '1/1')" />
        <Group gap="2" align="baseline" justify="between">
          <Text size="sm" weight="semibold">
            {{ d.name }}
          </Text>
          <Text size="xs" class="text-muted-foreground">
            {{ d.weight }}
          </Text>
        </Group>
        <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>
      </ListItem>
    </List>
  </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-strip
blocks/dish-strip.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 horizontal strip of dishes that scrolls sideways (a focusable, named region with snap points): small cards
 * with a picture, name, weight, price and an add button. Axes: size (sm, lg), tone.
 */
import { For, type JSX } from "solid-js";
import { Group, Inline, List, ListItem, Text } from "../compose";
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 { fmtMoney, tpl } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";

export type DishStripProps = {
  id: string;
  title: string;
  lead?: string;
  dishes: Dish[];
  empty?: string;
  labels: FoodLabels;
  size?: "sm" | "lg";
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function DishStrip({
  id,
  title,
  lead = "",
  dishes,
  empty = "",
  labels,
  size = "sm",
  tone = "default",
  landmarkLabel,
}: DishStripProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
      {((dishes?.length ?? 0) === 0) ? (
        <EmptyState icon="star" title={empty} />
      ) : (
        <List
          tag="ul"
          class="-mx-4 flex snap-x gap-4 overflow-x-auto px-4 pb-4"
          tabindex={0}
          aria-label={labels.strip}
          data-slot="items"
        >
          <For each={dishes ?? []}>{(d) => (
            <ListItem
              class={
                (size as string) === "lg" ? "flex w-64 shrink-0 snap-start flex-col gap-2"
                : "flex w-48 shrink-0 snap-start flex-col gap-2"
              }
              data-slot="item"
            >
              <MediaFrame alt={d.name} src={d.image} ratio={(((size as string) === "lg") ? "4/3" : "1/1")} />
              <Group gap="2" align="baseline" justify="between">
                <Text size="sm" weight="semibold">
                  {d.name}
                </Text>
                <Text size="xs" class="text-muted-foreground">
                  {d.weight}
                </Text>
              </Group>
              <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>
            </ListItem>
          )}</For>
        </List>
      )}
    </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-strip
blocks/dish-strip.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-strip.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"
)

// DishStripProps are the props of DishStrip; the values are the JSON shapes of the TypeScript props.
type DishStripProps 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"`
	Size any `json:"size"`
	Tone any `json:"tone"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A horizontal strip of dishes that scrolls sideways (a focusable, named region with snap points): small cards with a picture, name, weight, price and an add button. Axes: size (sm, lg), tone.
templ DishStrip(p DishStripProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vLead := uiutils.Def(p.Lead, "") }}
	{{ vDishes := p.Dishes }}
	{{ vEmpty := uiutils.Def(p.Empty, "") }}
	{{ vLabels := p.Labels }}
	{{ vSize := uiutils.Def(p.Size, "sm") }}
	{{ 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.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ul", Class: "-mx-4 flex snap-x gap-4 overflow-x-auto px-4 pb-4", Attrs: uiutils.Attrs("tabindex", float64(0), "aria-label", uiutils.Get(vLabels, "strip"), "data-slot", "items")}}) {
				for _, vD := range uiutils.L(vDishes) {
					@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vSize, "lg")), "flex w-64 shrink-0 snap-start flex-col gap-2", "flex w-48 shrink-0 snap-start flex-col gap-2")), Attrs: uiutils.Attrs("data-slot", "item")}}) {
						@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vD, "name"), Src: uiutils.Get(vD, "image"), Ratio: uiutils.Cond(uiutils.T(uiutils.Eq(vSize, "lg")), "4/3", "1/1")})
						@compose.Group(compose.GroupProps{Gap: "2", Align: "baseline", Justify: "between", BoxProps: box.BoxProps{}}) {
							@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.Get(vD, "name")) }
							}
							@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
								{ uiutils.Text(uiutils.Get(vD, "weight")) }
							}
						}
						@compose.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-strip
blocks/dish-strip.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-strip.json
    A horizontal strip of dishes that scrolls sideways (a focusable, named region with snap points): small cards with a picture, name, weight, price and an add button. Axes: size (sm, lg), tone.
    Props (p): id, title, lead, dishes, empty, labels, size, 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_size = (p.size ?? 'sm') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_8 -%}
  {%- 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_7 -%}
      {%- for v_d in og_l(v_dishes) %}
        {%- set c_6 -%}
          {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image']), 'ratio': (og_t(og_eq(v_size, 'lg')) ? '4/3' : '1/1')}}, with_context = false) }}
          {%- set c_3 -%}
            {%- set c_1 -%}
              {{ og_text(og_get(v_d, ['name'])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
            {%- set c_2 -%}
              {{ og_text(og_get(v_d, ['weight'])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'baseline', 'justify': 'between', 'children': c_3}, with_context = false) }}
          {%- set c_5 -%}
            {%- 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-sm font-bold', 'children': c_4}, 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_5}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/ListItem.html.twig', {'class': og_s((og_t(og_eq(v_size, 'lg')) ? 'flex w-64 shrink-0 snap-start flex-col gap-2' : 'flex w-48 shrink-0 snap-start flex-col gap-2')), 'attrs': og_attrs(['data-slot', 'item']), 'children': c_6}, with_context = false) }}
      {%- endfor %}
    {%- endset -%}
    {{ include('compose/List.html.twig', {'tag': 'ul', 'class': '-mx-4 flex snap-x gap-4 overflow-x-auto px-4 pb-4', 'attrs': og_attrs(['tabindex', 0, 'aria-label', og_get(v_labels, ['strip']), 'data-slot', 'items']), 'children': c_7}, 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_8)}, 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-strip
blocks/dish-strip.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-strip.json
    A horizontal strip of dishes that scrolls sideways (a focusable, named region with snap points): small cards with a picture, name, weight, price and an add button. Axes: size (sm, lg), tone.
    Props (p): id, title, lead, dishes, empty, labels, size, 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_size = ($p['size'] ?? 'sm')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_8}
  {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_7}
      {foreach og_l($v_dishes) as $v_d}
        {capture $c_6}
          {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_d, ['name']), 'src' => og_get($v_d, ['image']), 'ratio' => (og_t(og_eq($v_size, 'lg')) ? '4/3' : '1/1')]])|noescape}
          {capture $c_3}
            {capture $c_1}
              {=og_text(og_get($v_d, ['name']))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
            {capture $c_2}
              {=og_text(og_get($v_d, ['weight']))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
          {/capture}
          {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'baseline', 'justify' => 'between', 'children' => (string) $c_3])|noescape}
          {capture $c_5}
            {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-sm font-bold', 'children' => (string) $c_4])|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_5])|noescape}
        {/capture}
        {=og_include('compose/ListItem.latte', ['class' => og_s((og_t(og_eq($v_size, 'lg')) ? 'flex w-64 shrink-0 snap-start flex-col gap-2' : 'flex w-48 shrink-0 snap-start flex-col gap-2')), 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_6])|noescape}
      {/foreach}
    {/capture}
    {=og_include('compose/List.latte', ['tag' => 'ul', 'class' => '-mx-4 flex snap-x gap-4 overflow-x-auto px-4 pb-4', 'attrs' => og_attrs(['tabindex', 0, 'aria-label', og_get($v_labels, ['strip']), 'data-slot', 'items']), 'children' => (string) $c_7])|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_8)])|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-strip
blocks/dish-strip.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-strip.json
    A horizontal strip of dishes that scrolls sideways (a focusable, named region with snap points): small cards with a picture, name, weight, price and an add button. Axes: size (sm, lg), tone.
    Props (p): id, title, lead, dishes, empty, labels, size, 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_size = og_def(p['size'], 'sm') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_8 -%}
  {%- 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_7 -%}
      {%- for v_d in og_l(v_dishes) %}
        {%- set c_6 -%}
          {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image']), 'ratio': ('4/3' if og_t(og_eq(v_size, 'lg')) else '1/1')}}) }}
          {%- set c_3 -%}
            {%- set c_1 -%}
              {{ og_text(og_get(v_d, ['name'])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
            {%- set c_2 -%}
              {{ og_text(og_get(v_d, ['weight'])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
          {%- endset -%}
          {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'baseline', 'Justify': 'between'}, 'children': c_3}) }}
          {%- set c_5 -%}
            {%- 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-sm font-bold'}, 'children': c_4}) }}
            {{ 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_5}) }}
        {%- endset -%}
        {{ og_include('compose/list-item.html.j2', {'p': {'Class': og_s(('flex w-64 shrink-0 snap-start flex-col gap-2' if og_t(og_eq(v_size, 'lg')) else 'flex w-48 shrink-0 snap-start flex-col gap-2')), 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_6}) }}
      {%- endfor %}
    {%- endset -%}
    {{ og_include('compose/list.html.j2', {'p': {'Tag': 'ul', 'Class': '-mx-4 flex snap-x gap-4 overflow-x-auto px-4 pb-4', 'Attrs': og_attrs(['tabindex', 0, 'aria-label', og_get(v_labels, ['strip']), 'data-slot', 'items'])}, 'children': c_7}) }}
  {%- 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_8)}) }}

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 horizontal strip of dishes that scrolls sideways (a focusable, named region with snap points): small cards with a picture, name, weight, price and an add button. Axes: size (sm, lg), tone.

Props of DishStrip
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-
size "sm" | "lg""sm"
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