Skip to content
ui8kit

component / components

Option Chips

Option Chips component

Install

npx ui8kit add option-chips

Pulls in: box, compose, fieldset, inline, kit-box, kit-label, kit-radio, kit-text, label, legend, radio, utils

Preview

Main

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 option-chips
components/option-chips.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. -->
<!--
  One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per
  option (the first checked), the name and an optional price or note. Static markup.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { DishOption } from "./option-chips.types";

  export type OptionChipsProps = {
    name: string;
    legend: string;
    options: DishOption[];
    extra?: "none" | "price" | "note";
    layout?: "wrap" | "column";
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Fieldset from "../compose/Fieldset.svelte";
  import Inline from "../compose/Inline.svelte";
  import Label from "../compose/Label.svelte";
  import Legend from "../compose/Legend.svelte";
  import Radio from "../compose/Radio.svelte";
  import { cn, fmtMoney, tpl } from "../utils";

  let { name, legend, options, extra = "none", layout = "wrap" }: OptionChipsProps = $props();
</script>

<Fieldset
  class="flex flex-col gap-2"
  role="radiogroup"
  aria-labelledby={tpl("{0}-legend", name)}
  data-slot="option-group"
>
  <Legend size="sm" class="mb-2" id={tpl("{0}-legend", name)}>
    {legend}
  </Legend>
  <Box class={(((layout as string) === "column") ? "flex flex-col gap-2" : "flex flex-wrap gap-2")}>
    {#each options as o, i (o.id)}
      <Label
        class={cn(
          "flex items-center gap-2 rounded px-4 py-2 text-sm inset-ring inset-ring-border has-checked:bg-muted " +
            "has-checked:inset-ring-foreground",
          (((layout as string) === "column") ? "justify-between" : "")
        )}
        data-slot="option"
      >
        <Inline class="flex items-center gap-2">
          <Radio name={name} value={o.id} checked={(i === 0)} />
          <Inline>
            {o.name}
          </Inline>
        </Inline>
        {#if ((extra as string) === "price")}
          <Inline class="text-muted-foreground">
            {fmtMoney(o.price, o.currency)}
          </Inline>
        {/if}
        {#if ((extra as string) === "note")}
          <Inline class="text-muted-foreground">
            {o.note}
          </Inline>
        {/if}
      </Label>
    {/each}
  </Box>
</Fieldset>
components/option-chips.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 DishOption = {
  id: string;
  name: string;
  price: number;
  currency: string;
  note: string;
  image?: 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 option-chips
components/option-chips.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.
/**
 * One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per
 * option (the first checked), the name and an optional price or note. Static markup.
 */
import { type ReactNode } from "react";
import { Box, Fieldset, Inline, Label, Legend, Radio } from "../compose";
import { cn, fmtMoney, tpl } from "../utils";
import type { DishOption } from "./option-chips.types";

export type OptionChipsProps = {
  name: string;
  legend: string;
  options: DishOption[];
  extra?: "none" | "price" | "note";
  layout?: "wrap" | "column";
};

export function OptionChips({ name, legend, options, extra = "none", layout = "wrap" }: OptionChipsProps) {
  return (
    <Fieldset
      className="flex flex-col gap-2"
      role="radiogroup"
      aria-labelledby={tpl("{0}-legend", name)}
      data-slot="option-group"
    >
      <Legend size="sm" className="mb-2" id={tpl("{0}-legend", name)}>
        {legend}
      </Legend>
      <Box className={(((layout as string) === "column") ? "flex flex-col gap-2" : "flex flex-wrap gap-2")}>
        {(options ?? []).map((o, i) => (
          <Label key={o.id}
            className={cn(
              "flex items-center gap-2 rounded px-4 py-2 text-sm inset-ring inset-ring-border has-checked:bg-muted " +
                "has-checked:inset-ring-foreground",
              (((layout as string) === "column") ? "justify-between" : "")
            )}
            data-slot="option"
          >
            <Inline className="flex items-center gap-2">
              <Radio name={name} value={o.id} checked={(i === 0)} />
              <Inline>
                {o.name}
              </Inline>
            </Inline>
            {((extra as string) === "price") ? (
              <Inline className="text-muted-foreground">
                {fmtMoney(o.price, o.currency)}
              </Inline>
            ) : null}
            {((extra as string) === "note") ? (
              <Inline className="text-muted-foreground">
                {o.note}
              </Inline>
            ) : null}
          </Label>
        ))}
      </Box>
    </Fieldset>
  );
}
components/option-chips.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 DishOption = {
  id: string;
  name: string;
  price: number;
  currency: string;
  note: string;
  image?: 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 option-chips
components/option-chips.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 DishOption = {
  id: string;
  name: string;
  price: number;
  currency: string;
  note: string;
  image?: string;
};
components/option-chips.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. -->
<!--
  One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per
  option (the first checked), the name and an optional price or note. Static markup.
-->
<script lang="ts">
import type { DishOption } from "./option-chips.types";

export type OptionChipsProps = {
  name: string;
  legend: string;
  options: DishOption[];
  extra?: "none" | "price" | "note";
  layout?: "wrap" | "column";
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Fieldset from "../compose/Fieldset.vue";
import Inline from "../compose/Inline.vue";
import Label from "../compose/Label.vue";
import Legend from "../compose/Legend.vue";
import Radio from "../compose/Radio.vue";
import { cn, fmtMoney, tpl } from "../utils";

const { name, legend, options, extra = "none", layout = "wrap" } = defineProps<OptionChipsProps>();
</script>

<template>
  <Fieldset
    class="flex flex-col gap-2"
    role="radiogroup"
    :aria-labelledby="tpl('{0}-legend', name)"
    data-slot="option-group"
  >
    <Legend size="sm" class="mb-2" :id="tpl('{0}-legend', name)">
      {{ legend }}
    </Legend>
    <Box :class="(((layout as string) === 'column') ? 'flex flex-col gap-2' : 'flex flex-wrap gap-2')">
      <Label v-for="(o, i) in options" :key="o.id"
        :class="cn(
          'flex items-center gap-2 rounded px-4 py-2 text-sm inset-ring inset-ring-border has-checked:bg-muted ' +
            'has-checked:inset-ring-foreground',
          (((layout as string) === 'column') ? 'justify-between' : '')
        )"
        data-slot="option"
      >
        <Inline class="flex items-center gap-2">
          <Radio :name="name" :value="o.id" :checked="(i === 0)" />
          <Inline>
            {{ o.name }}
          </Inline>
        </Inline>
        <Inline v-if="((extra as string) === 'price')" class="text-muted-foreground">
          {{ fmtMoney(o.price, o.currency) }}
        </Inline>
        <Inline v-if="((extra as string) === 'note')" class="text-muted-foreground">
          {{ o.note }}
        </Inline>
      </Label>
    </Box>
  </Fieldset>
</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 option-chips
components/option-chips.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.
/**
 * One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per
 * option (the first checked), the name and an optional price or note. Static markup.
 */
import { For, type JSX } from "solid-js";
import { Box, Fieldset, Inline, Label, Legend, Radio } from "../compose";
import { cn, fmtMoney, tpl } from "../utils";
import type { DishOption } from "./option-chips.types";

export type OptionChipsProps = {
  name: string;
  legend: string;
  options: DishOption[];
  extra?: "none" | "price" | "note";
  layout?: "wrap" | "column";
};

export function OptionChips({ name, legend, options, extra = "none", layout = "wrap" }: OptionChipsProps) {
  return (
    <Fieldset
      class="flex flex-col gap-2"
      role="radiogroup"
      aria-labelledby={tpl("{0}-legend", name)}
      data-slot="option-group"
    >
      <Legend size="sm" class="mb-2" id={tpl("{0}-legend", name)}>
        {legend}
      </Legend>
      <Box class={(((layout as string) === "column") ? "flex flex-col gap-2" : "flex flex-wrap gap-2")}>
        <For each={options ?? []}>{(o, iOf) => { const i = iOf(); return (
          <Label
            class={cn(
              "flex items-center gap-2 rounded px-4 py-2 text-sm inset-ring inset-ring-border has-checked:bg-muted " +
                "has-checked:inset-ring-foreground",
              (((layout as string) === "column") ? "justify-between" : "")
            )}
            data-slot="option"
          >
            <Inline class="flex items-center gap-2">
              <Radio name={name} value={o.id} checked={(i === 0)} />
              <Inline>
                {o.name}
              </Inline>
            </Inline>
            {((extra as string) === "price") ? (
              <Inline class="text-muted-foreground">
                {fmtMoney(o.price, o.currency)}
              </Inline>
            ) : null}
            {((extra as string) === "note") ? (
              <Inline class="text-muted-foreground">
                {o.note}
              </Inline>
            ) : null}
          </Label>
        ); }}</For>
      </Box>
    </Fieldset>
  );
}
components/option-chips.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 DishOption = {
  id: string;
  name: string;
  price: number;
  currency: string;
  note: string;
  image?: 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 option-chips
blocks/option-chips.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/option-chips.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/label"
	"github.com/ui8kit/codegen/generated/templ/ui/radio"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// OptionChipsProps are the props of OptionChips; the values are the JSON shapes of the TypeScript props.
type OptionChipsProps struct {
	Name any `json:"name"`
	Legend any `json:"legend"`
	Options any `json:"options"`
	Extra any `json:"extra"`
	Layout any `json:"layout"`
}

// One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per option (the first checked), the name and an optional price or note. Static markup.
templ OptionChips(p OptionChipsProps) {
	{{ vName := p.Name }}
	{{ vLegend := p.Legend }}
	{{ vOptions := p.Options }}
	{{ vExtra := uiutils.Def(p.Extra, "none") }}
	{{ vLayout := uiutils.Def(p.Layout, "wrap") }}
	@compose.Fieldset(compose.FieldsetProps{BoxProps: box.BoxProps{Class: "flex flex-col gap-2", Attrs: uiutils.Attrs("role", "radiogroup", "aria-labelledby", uiutils.Tpl("{0}-legend", vName), "data-slot", "option-group")}}) {
		@compose.Legend(compose.LegendProps{Size: "sm", TextProps: text.TextProps{Class: "mb-2", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-legend", vName))}}) {
			{ uiutils.Text(vLegend) }
		}
		@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "column")), "flex flex-col gap-2", "flex flex-wrap gap-2"))}}) {
			for vI, vO := range uiutils.L(vOptions) {
				@compose.Label(compose.LabelProps{LabelProps: label.LabelProps{Class: uiutils.S(uiutils.Cnv("flex items-center gap-2 rounded px-4 py-2 text-sm inset-ring inset-ring-border has-checked:bg-muted has-checked:inset-ring-foreground", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "column")), "justify-between", ""))), Attrs: uiutils.Attrs("data-slot", "option")}}) {
					@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex items-center gap-2"}}) {
						@compose.Radio(compose.RadioProps{RadioProps: radio.RadioProps{Name: uiutils.S(vName), Value: uiutils.SP(uiutils.Get(vO, "id")), Checked: uiutils.T(uiutils.Eq(float64(vI), float64(0)))}})
						@compose.Inline(compose.InlineProps{TextProps: text.TextProps{}}) {
							{ uiutils.Text(uiutils.Get(vO, "name")) }
						}
					}
					if uiutils.Eq(vExtra, "price") {
						@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
							{ uiutils.Text(uiutils.Money(uiutils.Get(vO, "price"), uiutils.Get(vO, "currency"))) }
						}
					}
					if uiutils.Eq(vExtra, "note") {
						@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
							{ uiutils.Text(uiutils.Get(vO, "note")) }
						}
					}
				}
			}
		}
	}
}

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 option-chips
blocks/option-chips.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/option-chips.json
    One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per option (the first checked), the name and an optional price or note. Static markup.
    Props (p): name, legend, options, extra, layout. -#}
{%- set v_name = (p.name ?? null) -%}
{%- set v_legend = (p.legend ?? null) -%}
{%- set v_options = (p.options ?? null) -%}
{%- set v_extra = (p.extra ?? 'none') -%}
{%- set v_layout = (p.layout ?? 'wrap') -%}
{%- set c_8 -%}
  {%- set c_1 -%}
    {{ og_text(v_legend) }}
  {%- endset -%}
  {{ include('compose/Legend.html.twig', {'size': 'sm', 'class': 'mb-2', 'attrs': og_attrs(['id', og_tpl('{0}-legend', [v_name])]), 'children': c_1}, with_context = false) }}
  {%- set c_7 -%}
    {%- for v_o in og_l(v_options) %}
      {%- set v_i = loop.index0 -%}
      {%- set c_6 -%}
        {%- set c_3 -%}
          {{ include('compose/Radio.html.twig', {'name': og_s(v_name), 'value': og_s(og_get(v_o, ['id'])), 'checked': og_t(og_eq(v_i, 0))}, with_context = false) }}
          {%- set c_2 -%}
            {{ og_text(og_get(v_o, ['name'])) }}
          {%- endset -%}
          {{ include('compose/Inline.html.twig', {'children': c_2}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Inline.html.twig', {'class': 'flex items-center gap-2', 'children': c_3}, with_context = false) }}
        {%- if og_t(og_eq(v_extra, 'price')) %}
          {%- set c_4 -%}
            {{ og_text(og_money(og_get(v_o, ['price']), og_get(v_o, ['currency']))) }}
          {%- endset -%}
          {{ include('compose/Inline.html.twig', {'class': 'text-muted-foreground', 'children': c_4}, with_context = false) }}
        {%- endif %}
        {%- if og_t(og_eq(v_extra, 'note')) %}
          {%- set c_5 -%}
            {{ og_text(og_get(v_o, ['note'])) }}
          {%- endset -%}
          {{ include('compose/Inline.html.twig', {'class': 'text-muted-foreground', 'children': c_5}, with_context = false) }}
        {%- endif %}
      {%- endset -%}
      {{ include('compose/Label.html.twig', {'class': og_s(og_cnv(['flex items-center gap-2 rounded px-4 py-2 text-sm inset-ring inset-ring-border has-checked:bg-muted has-checked:inset-ring-foreground', (og_t(og_eq(v_layout, 'column')) ? 'justify-between' : '')])), 'attrs': og_attrs(['data-slot', 'option']), 'children': c_6}, with_context = false) }}
    {%- endfor %}
  {%- endset -%}
  {{ include('compose/Box.html.twig', {'class': og_s((og_t(og_eq(v_layout, 'column')) ? 'flex flex-col gap-2' : 'flex flex-wrap gap-2')), 'children': c_7}, with_context = false) }}
{%- endset -%}
{{ include('compose/Fieldset.html.twig', {'class': 'flex flex-col gap-2', 'attrs': og_attrs(['role', 'radiogroup', 'aria-labelledby', og_tpl('{0}-legend', [v_name]), 'data-slot', 'option-group']), 'children': 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 option-chips
blocks/option-chips.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/option-chips.json
    One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per option (the first checked), the name and an optional price or note. Static markup.
    Props (p): name, legend, options, extra, layout. *}
{var $v_name = ($p['name'] ?? null)}
{var $v_legend = ($p['legend'] ?? null)}
{var $v_options = ($p['options'] ?? null)}
{var $v_extra = ($p['extra'] ?? 'none')}
{var $v_layout = ($p['layout'] ?? 'wrap')}
{capture $c_8}
  {capture $c_1}
    {=og_text($v_legend)}
  {/capture}
  {=og_include('compose/Legend.latte', ['size' => 'sm', 'class' => 'mb-2', 'attrs' => og_attrs(['id', og_tpl('{0}-legend', [$v_name])]), 'children' => (string) $c_1])|noescape}
  {capture $c_7}
    {foreach og_l($v_options) as $v_o}
      {var $v_i = $iterator->counter0}
      {capture $c_6}
        {capture $c_3}
          {=og_include('compose/Radio.latte', ['name' => og_s($v_name), 'value' => og_s(og_get($v_o, ['id'])), 'checked' => og_t(og_eq($v_i, 0))])|noescape}
          {capture $c_2}
            {=og_text(og_get($v_o, ['name']))}
          {/capture}
          {=og_include('compose/Inline.latte', ['children' => (string) $c_2])|noescape}
        {/capture}
        {=og_include('compose/Inline.latte', ['class' => 'flex items-center gap-2', 'children' => (string) $c_3])|noescape}
        {if og_t(og_eq($v_extra, 'price'))}
          {capture $c_4}
            {=og_text(og_money(og_get($v_o, ['price']), og_get($v_o, ['currency'])))}
          {/capture}
          {=og_include('compose/Inline.latte', ['class' => 'text-muted-foreground', 'children' => (string) $c_4])|noescape}
        {/if}
        {if og_t(og_eq($v_extra, 'note'))}
          {capture $c_5}
            {=og_text(og_get($v_o, ['note']))}
          {/capture}
          {=og_include('compose/Inline.latte', ['class' => 'text-muted-foreground', 'children' => (string) $c_5])|noescape}
        {/if}
      {/capture}
      {=og_include('compose/Label.latte', ['class' => og_s(og_cnv(['flex items-center gap-2 rounded px-4 py-2 text-sm inset-ring inset-ring-border has-checked:bg-muted has-checked:inset-ring-foreground', (og_t(og_eq($v_layout, 'column')) ? 'justify-between' : '')])), 'attrs' => og_attrs(['data-slot', 'option']), 'children' => (string) $c_6])|noescape}
    {/foreach}
  {/capture}
  {=og_include('compose/Box.latte', ['class' => og_s((og_t(og_eq($v_layout, 'column')) ? 'flex flex-col gap-2' : 'flex flex-wrap gap-2')), 'children' => (string) $c_7])|noescape}
{/capture}
{=og_include('compose/Fieldset.latte', ['class' => 'flex flex-col gap-2', 'attrs' => og_attrs(['role', 'radiogroup', 'aria-labelledby', og_tpl('{0}-legend', [$v_name]), 'data-slot', 'option-group']), 'children' => (string) $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 option-chips
blocks/option-chips.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/option-chips.json
    One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per option (the first checked), the name and an optional price or note. Static markup.
    Props (p): name, legend, options, extra, layout. -#}
{%- set v_name = og_def(p['name'], none) -%}
{%- set v_legend = og_def(p['legend'], none) -%}
{%- set v_options = og_def(p['options'], none) -%}
{%- set v_extra = og_def(p['extra'], 'none') -%}
{%- set v_layout = og_def(p['layout'], 'wrap') -%}
{%- set c_8 -%}
  {%- set c_1 -%}
    {{ og_text(v_legend) }}
  {%- endset -%}
  {{ og_include('compose/legend.html.j2', {'p': {'Size': 'sm', 'Class': 'mb-2', 'Attrs': og_attrs(['id', og_tpl('{0}-legend', [v_name])])}, 'children': c_1}) }}
  {%- set c_7 -%}
    {%- for v_o in og_l(v_options) %}
      {%- set v_i = loop.index0 -%}
      {%- set c_6 -%}
        {%- set c_3 -%}
          {{ og_include('compose/radio.html.j2', {'p': {'Name': og_s(v_name), 'Value': og_s(og_get(v_o, ['id'])), 'Checked': og_t(og_eq(v_i, 0))}}) }}
          {%- set c_2 -%}
            {{ og_text(og_get(v_o, ['name'])) }}
          {%- endset -%}
          {{ og_include('compose/inline.html.j2', {'p': {}, 'children': c_2}) }}
        {%- endset -%}
        {{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex items-center gap-2'}, 'children': c_3}) }}
        {%- if og_t(og_eq(v_extra, 'price')) %}
          {%- set c_4 -%}
            {{ og_text(og_money(og_get(v_o, ['price']), og_get(v_o, ['currency']))) }}
          {%- endset -%}
          {{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-muted-foreground'}, 'children': c_4}) }}
        {%- endif %}
        {%- if og_t(og_eq(v_extra, 'note')) %}
          {%- set c_5 -%}
            {{ og_text(og_get(v_o, ['note'])) }}
          {%- endset -%}
          {{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-muted-foreground'}, 'children': c_5}) }}
        {%- endif %}
      {%- endset -%}
      {{ og_include('compose/label.html.j2', {'p': {'Class': og_s(og_cnv(['flex items-center gap-2 rounded px-4 py-2 text-sm inset-ring inset-ring-border has-checked:bg-muted has-checked:inset-ring-foreground', ('justify-between' if og_t(og_eq(v_layout, 'column')) else '')])), 'Attrs': og_attrs(['data-slot', 'option'])}, 'children': c_6}) }}
    {%- endfor %}
  {%- endset -%}
  {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(('flex flex-col gap-2' if og_t(og_eq(v_layout, 'column')) else 'flex flex-wrap gap-2'))}, 'children': c_7}) }}
{%- endset -%}
{{ og_include('compose/fieldset.html.j2', {'p': {'Class': 'flex flex-col gap-2', 'Attrs': og_attrs(['role', 'radiogroup', 'aria-labelledby', og_tpl('{0}-legend', [v_name]), 'data-slot', 'option-group'])}, 'children': 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.

One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per option (the first checked), the name and an optional price or note. Static markup.

Props of OptionChips
PropTypeDefault Description
name (required)string-name of the radio group; the legend id is `<name>-legend`
legend (required)string-the visible name of the group
options (required)DishOption[]-
extra "none" | "price" | "note""none"what follows the option name
layout "wrap" | "column""wrap"

Used in