Menu Row
Menu Row component
Install
npx ui8kit add menu-rowPulls in: badge, box, compose, dish-showcase, inline, kit-box, kit-text, list-item, 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-cdnnpx ui8kit add menu-row<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
One dish on a menu board: name, optional badge, a dotted leader to the price, then the summary and the
portion/weight. Used by MenuBoard; Codex kind `dish`.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Dish } from "../blocks/dish-showcase.types";
export type MenuRowProps = {
dish: Dish;
prices?: "show" | "hide";
};
</script>
<script lang="ts">
import Badge from "../compose/Badge.svelte";
import Box from "../compose/Box.svelte";
import Inline from "../compose/Inline.svelte";
import ListItem from "../compose/ListItem.svelte";
import { fmtMoney, tpl } from "../utils";
let { dish, prices = "show" }: MenuRowProps = $props();
</script>
<ListItem class="flex flex-col gap-0 border-b border-border py-2" data-slot="item">
<Box class="flex items-baseline gap-2">
<Inline class="font-semibold">
{dish.name}
</Inline>
{#if dish.badge}
<Badge variant="outline" size="sm">
{dish.badge}
</Badge>
{/if}
{#if ((prices as string) === "show")}
<Inline class="flex-1 border-b border-dotted border-border" aria-hidden="true" />
<Inline class="font-semibold" data-slot="price">
{fmtMoney(dish.price, dish.currency)}
</Inline>
{/if}
</Box>
<Inline class="text-sm text-muted-foreground">
{tpl("{0} · {1}", dish.summary, dish.weight)}
</Inline>
</ListItem>
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-cdnnpx ui8kit add menu-row// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* One dish on a menu board: name, optional badge, a dotted leader to the price, then the summary and the
* portion/weight. Used by MenuBoard; Codex kind `dish`.
*/
import { type ReactNode } from "react";
import { Badge, Box, Inline, ListItem } from "../compose";
import { fmtMoney, tpl } from "../utils";
import type { Dish } from "../blocks/dish-showcase.types";
export type MenuRowProps = {
dish: Dish;
prices?: "show" | "hide";
};
export function MenuRow({ dish, prices = "show" }: MenuRowProps) {
return (
<ListItem className="flex flex-col gap-0 border-b border-border py-2" data-slot="item">
<Box className="flex items-baseline gap-2">
<Inline className="font-semibold">
{dish.name}
</Inline>
{dish.badge ? (
<Badge variant="outline" size="sm">
{dish.badge}
</Badge>
) : null}
{((prices as string) === "show") ? (
<>
<Inline className="flex-1 border-b border-dotted border-border" aria-hidden="true" />
<Inline className="font-semibold" data-slot="price">
{fmtMoney(dish.price, dish.currency)}
</Inline>
</>
) : null}
</Box>
<Inline className="text-sm text-muted-foreground">
{tpl("{0} · {1}", dish.summary, dish.weight)}
</Inline>
</ListItem>
);
}
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-cdnnpx ui8kit add menu-row<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
One dish on a menu board: name, optional badge, a dotted leader to the price, then the summary and the
portion/weight. Used by MenuBoard; Codex kind `dish`.
-->
<script lang="ts">
import type { Dish } from "../blocks/dish-showcase.types";
export type MenuRowProps = {
dish: Dish;
prices?: "show" | "hide";
};
</script>
<script setup lang="ts">
import Badge from "../compose/Badge.vue";
import Box from "../compose/Box.vue";
import Inline from "../compose/Inline.vue";
import ListItem from "../compose/ListItem.vue";
import { fmtMoney, tpl } from "../utils";
const { dish, prices = "show" } = defineProps<MenuRowProps>();
</script>
<template>
<ListItem class="flex flex-col gap-0 border-b border-border py-2" data-slot="item">
<Box class="flex items-baseline gap-2">
<Inline class="font-semibold">
{{ dish.name }}
</Inline>
<Badge v-if="dish.badge" variant="outline" size="sm">
{{ dish.badge }}
</Badge>
<template v-if="((prices as string) === 'show')">
<Inline class="flex-1 border-b border-dotted border-border" aria-hidden="true" />
<Inline class="font-semibold" data-slot="price">
{{ fmtMoney(dish.price, dish.currency) }}
</Inline>
</template>
</Box>
<Inline class="text-sm text-muted-foreground">
{{ tpl("{0} · {1}", dish.summary, dish.weight) }}
</Inline>
</ListItem>
</template>
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-cdnnpx ui8kit add menu-row// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* One dish on a menu board: name, optional badge, a dotted leader to the price, then the summary and the
* portion/weight. Used by MenuBoard; Codex kind `dish`.
*/
import { type JSX } from "solid-js";
import { Badge, Box, Inline, ListItem } from "../compose";
import { fmtMoney, tpl } from "../utils";
import type { Dish } from "../blocks/dish-showcase.types";
export type MenuRowProps = {
dish: Dish;
prices?: "show" | "hide";
};
export function MenuRow({ dish, prices = "show" }: MenuRowProps) {
return (
<ListItem class="flex flex-col gap-0 border-b border-border py-2" data-slot="item">
<Box class="flex items-baseline gap-2">
<Inline class="font-semibold">
{dish.name}
</Inline>
{dish.badge ? (
<Badge variant="outline" size="sm">
{dish.badge}
</Badge>
) : null}
{((prices as string) === "show") ? (
<>
<Inline class="flex-1 border-b border-dotted border-border" aria-hidden="true" />
<Inline class="font-semibold" data-slot="price">
{fmtMoney(dish.price, dish.currency)}
</Inline>
</>
) : null}
</Box>
<Inline class="text-sm text-muted-foreground">
{tpl("{0} · {1}", dish.summary, dish.weight)}
</Inline>
</ListItem>
);
}
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-cdnnpx ui8kit add menu-row// 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-row.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"
)
// MenuRowProps are the props of MenuRow; the values are the JSON shapes of the TypeScript props.
type MenuRowProps struct {
Dish any `json:"dish"`
Prices any `json:"prices"`
}
// One dish on a menu board: name, optional badge, a dotted leader to the price, then the summary and the portion/weight. Used by MenuBoard; Codex kind `dish`.
templ MenuRow(p MenuRowProps) {
{{ vDish := p.Dish }}
{{ vPrices := uiutils.Def(p.Prices, "show") }}
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex flex-col gap-0 border-b border-border py-2", Attrs: uiutils.Attrs("data-slot", "item")}}) {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "flex items-baseline gap-2"}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "font-semibold"}}) {
{ uiutils.Text(uiutils.Get(vDish, "name")) }
}
if uiutils.T(uiutils.Get(vDish, "badge")) {
@compose.Badge(compose.BadgeProps{Variant: "outline", Size: "sm", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vDish, "badge")) }
}
}
if uiutils.Eq(vPrices, "show") {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex-1 border-b border-dotted border-border", Attrs: uiutils.Attrs("aria-hidden", "true")}})
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "font-semibold", Attrs: uiutils.Attrs("data-slot", "price")}}) {
{ uiutils.Text(uiutils.Money(uiutils.Get(vDish, "price"), uiutils.Get(vDish, "currency"))) }
}
}
}
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-sm text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Tpl("{0} · {1}", uiutils.Get(vDish, "summary"), uiutils.Get(vDish, "weight"))) }
}
}
}
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-cdnnpx ui8kit add menu-row{#- 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-row.json
One dish on a menu board: name, optional badge, a dotted leader to the price, then the summary and the portion/weight. Used by MenuBoard; Codex kind `dish`.
Props (p): dish, prices. -#}
{%- set v_dish = (p.dish ?? null) -%}
{%- set v_prices = (p.prices ?? 'show') -%}
{%- set c_6 -%}
{%- set c_4 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_dish, ['name'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'font-semibold', 'children': c_1}, with_context = false) }}
{%- if og_t(og_get(v_dish, ['badge'])) %}
{%- set c_2 -%}
{{ og_text(og_get(v_dish, ['badge'])) }}
{%- endset -%}
{{ include('compose/Badge.html.twig', {'variant': 'outline', 'size': 'sm', 'children': c_2}, with_context = false) }}
{%- endif %}
{%- if og_t(og_eq(v_prices, 'show')) %}
{{ include('compose/Inline.html.twig', {'class': 'flex-1 border-b border-dotted border-border', 'attrs': og_attrs(['aria-hidden', 'true'])}, with_context = false) }}
{%- set c_3 -%}
{{ og_text(og_money(og_get(v_dish, ['price']), og_get(v_dish, ['currency']))) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'font-semibold', 'attrs': og_attrs(['data-slot', 'price']), 'children': c_3}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'flex items-baseline gap-2', 'children': c_4}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_tpl('{0} · {1}', [og_get(v_dish, ['summary']), og_get(v_dish, ['weight'])])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-sm text-muted-foreground', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': 'flex flex-col gap-0 border-b border-border py-2', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_6}, with_context = false) }}
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-cdnnpx ui8kit add menu-row{* 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-row.json
One dish on a menu board: name, optional badge, a dotted leader to the price, then the summary and the portion/weight. Used by MenuBoard; Codex kind `dish`.
Props (p): dish, prices. *}
{var $v_dish = ($p['dish'] ?? null)}
{var $v_prices = ($p['prices'] ?? 'show')}
{capture $c_6}
{capture $c_4}
{capture $c_1}
{=og_text(og_get($v_dish, ['name']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'font-semibold', 'children' => (string) $c_1])|noescape}
{if og_t(og_get($v_dish, ['badge']))}
{capture $c_2}
{=og_text(og_get($v_dish, ['badge']))}
{/capture}
{=og_include('compose/Badge.latte', ['variant' => 'outline', 'size' => 'sm', 'children' => (string) $c_2])|noescape}
{/if}
{if og_t(og_eq($v_prices, 'show'))}
{=og_include('compose/Inline.latte', ['class' => 'flex-1 border-b border-dotted border-border', 'attrs' => og_attrs(['aria-hidden', 'true'])])|noescape}
{capture $c_3}
{=og_text(og_money(og_get($v_dish, ['price']), og_get($v_dish, ['currency'])))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'font-semibold', 'attrs' => og_attrs(['data-slot', 'price']), 'children' => (string) $c_3])|noescape}
{/if}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'flex items-baseline gap-2', 'children' => (string) $c_4])|noescape}
{capture $c_5}
{=og_text(og_tpl('{0} · {1}', [og_get($v_dish, ['summary']), og_get($v_dish, ['weight'])]))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-sm text-muted-foreground', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => 'flex flex-col gap-0 border-b border-border py-2', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_6])|noescape}
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-cdnnpx ui8kit add menu-row{#- 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-row.json
One dish on a menu board: name, optional badge, a dotted leader to the price, then the summary and the portion/weight. Used by MenuBoard; Codex kind `dish`.
Props (p): dish, prices. -#}
{%- set v_dish = og_def(p['dish'], none) -%}
{%- set v_prices = og_def(p['prices'], 'show') -%}
{%- set c_6 -%}
{%- set c_4 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_dish, ['name'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'font-semibold'}, 'children': c_1}) }}
{%- if og_t(og_get(v_dish, ['badge'])) %}
{%- set c_2 -%}
{{ og_text(og_get(v_dish, ['badge'])) }}
{%- endset -%}
{{ og_include('compose/badge.html.j2', {'p': {'Variant': 'outline', 'Size': 'sm'}, 'children': c_2}) }}
{%- endif %}
{%- if og_t(og_eq(v_prices, 'show')) %}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex-1 border-b border-dotted border-border', 'Attrs': og_attrs(['aria-hidden', 'true'])}}) }}
{%- set c_3 -%}
{{ og_text(og_money(og_get(v_dish, ['price']), og_get(v_dish, ['currency']))) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'font-semibold', 'Attrs': og_attrs(['data-slot', 'price'])}, 'children': c_3}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'flex items-baseline gap-2'}, 'children': c_4}) }}
{%- set c_5 -%}
{{ og_text(og_tpl('{0} · {1}', [og_get(v_dish, ['summary']), og_get(v_dish, ['weight'])])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-sm text-muted-foreground'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex flex-col gap-0 border-b border-border py-2', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_6}) }}
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.
One dish on a menu board: name, optional badge, a dotted leader to the price, then the summary and the portion/weight. Used by MenuBoard; Codex kind `dish`.
| Prop | Type | Default | Description |
|---|---|---|---|
| dish (required) | Dish | - | |
| prices | "show" | "hide" | "show" |