Skip to content
ui8kit

block / commerce

Reservation Form

Book a table: name, phone, date, time, guests, optional notes and consent.

Install

npx ui8kit add reservation-form

Pulls in: box, button, checkbox, compose, feature-grid, field, form, grid, group, input, kit-box, kit-button, kit-checkbox, kit-form, kit-input, kit-label, kit-text, kit-textarea, label, lucide-icon, number-field, section-frame, stack, text, textarea, utils

Preview

Book a table

Tell us when you are coming and we will hold a table.

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 reservation-form
blocks/reservation-form.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 table reservation: name, phone and/or email, date, time, guests, optional notes and consent; in the split
  layout, the ways to reach the house sit beside the form. Axes: layout (single, split), density, fields (full,
  compact).
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { ReservationLabels } from "./reservation-form.types";
  import type { Feature } from "./feature-grid.types";

  export type ReservationFormProps = {
    id: string;
    title: string;
    text: string;
    labels: ReservationLabels;
    details: Feature[];
    layout?: "single" | "split";
    fields?: "full" | "compact";
    terms?: "show" | "hide";
    density?: "default" | "compact";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Button from "../compose/Button.svelte";
  import Checkbox from "../compose/Checkbox.svelte";
  import Form from "../compose/Form.svelte";
  import Grid from "../compose/Grid.svelte";
  import Group from "../compose/Group.svelte";
  import Input from "../compose/Input.svelte";
  import Label from "../compose/Label.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import Textarea from "../compose/Textarea.svelte";
  import Field from "../components/field.svelte";
  import NumberField from "../components/number-field.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { cn, tpl } from "../utils";

  let {
    id,
    title,
    text,
    labels,
    details,
    layout = "single",
    fields = "full",
    terms = "hide",
    density = "default",
    landmarkLabel,
  }: ReservationFormProps = $props();
</script>

<SectionFrame
  id={id}
  title={title}
  lead={text}
  density={density}
  measure={(((layout as string) === "single") ? "xl" : "default")}
  landmarkLabel={landmarkLabel}
>
  <Grid cols={(((layout as string) === "split") ? "1-2" : "1")} class="items-start gap-8">
    <Form method="dialog" class="flex w-full flex-col gap-4" data-slot="reservation-form">
      <Field label={labels.name} htmlFor={tpl("{0}-name", id)}>
        <Input type="text" name="name" autocomplete="name" id={tpl("{0}-name", id)} data-slot="field" />
      </Field>
      <Field label={labels.phone} htmlFor={tpl("{0}-phone", id)}>
        <Input type="tel" name="phone" autocomplete="tel" id={tpl("{0}-phone", id)} data-slot="field" />
      </Field>
      {#if ((fields as string) === "full")}
        <Field label={labels.email} htmlFor={tpl("{0}-email", id)}>
          <Input type="email" name="email" autocomplete="email" id={tpl("{0}-email", id)} data-slot="field" />
        </Field>
      {/if}
      <Group gap="4" class="flex-wrap">
        <Box class="min-w-0 flex-1">
          <Field label={labels.date} htmlFor={tpl("{0}-date", id)}>
            <Input type="date" name="date" id={tpl("{0}-date", id)} data-slot="field" />
          </Field>
        </Box>
        <Box class="min-w-0 flex-1">
          <Field label={labels.time} htmlFor={tpl("{0}-time", id)}>
            <Input type="time" name="time" id={tpl("{0}-time", id)} data-slot="field" />
          </Field>
        </Box>
      </Group>
      <Stack gap="2">
        <Label class="text-xs font-bold text-foreground">
          {labels.guests}
        </Label>
        <NumberField
          value="2"
          name={tpl("{0}-guests", id)}
          min="1"
          label={labels.guests}
          decrease={labels.decrease}
          increase={labels.increase}
        />
      </Stack>
      {#if ((fields as string) === "full")}
        <Field label={labels.notes} htmlFor={tpl("{0}-notes", id)}>
          <Textarea rows={4} name="notes" id={tpl("{0}-notes", id)} data-slot="field" />
        </Field>
      {/if}
      {#if ((terms as string) === "show")}
        <Group gap="2" align="center" class={cn("w-fit", "")}>
          <Checkbox name="consent" id={tpl("{0}-consent", id)} />
          <Label for={tpl("{0}-consent", id)} class="text-sm">
            {labels.consent}
          </Label>
        </Group>
      {/if}
      <Button variant="default" size="default" type="submit" class="w-fit">
        {labels.submit}
      </Button>
    </Form>
    {#if (((layout as string) === "split") && ((details?.length ?? 0) > 0))}
      <Stack gap="4" data-slot="details">
        {#each details as d (d.id)}
          <Group gap="4" align="start" data-slot="detail">
            <LucideIcon name={d.icon} size={20} />
            <Stack gap="0">
              <Text size="base" weight="semibold">
                {d.title}
              </Text>
              <Text size="sm" class="text-muted-foreground">
                {d.text}
              </Text>
            </Stack>
          </Group>
        {/each}
      </Stack>
    {/if}
  </Grid>
</SectionFrame>
blocks/reservation-form.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 ReservationLabels = {
  name: string;
  phone: string;
  email: string;
  date: string;
  time: string;
  guests: string;
  notes: string;
  consent: string;
  submit: string;
  decrease: string;
  increase: 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 reservation-form
blocks/reservation-form.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 table reservation: name, phone and/or email, date, time, guests, optional notes and consent; in the split
 * layout, the ways to reach the house sit beside the form. Axes: layout (single, split), density, fields (full,
 * compact).
 */
import { type ReactNode } from "react";
import { Box, Button, Checkbox, Form, Grid, Group, Input, Label, Stack, Text, Textarea } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { Field } from "../components/field";
import { NumberField } from "../components/number-field";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { ReservationLabels } from "./reservation-form.types";
import type { Feature } from "./feature-grid.types";

export type ReservationFormProps = {
  id: string;
  title: string;
  text: string;
  labels: ReservationLabels;
  details: Feature[];
  layout?: "single" | "split";
  fields?: "full" | "compact";
  terms?: "show" | "hide";
  density?: "default" | "compact";
  landmarkLabel?: string;
};

export function ReservationForm({
  id,
  title,
  text,
  labels,
  details,
  layout = "single",
  fields = "full",
  terms = "hide",
  density = "default",
  landmarkLabel,
}: ReservationFormProps) {
  return (
    <SectionFrame
      id={id}
      title={title}
      lead={text}
      density={density}
      measure={(((layout as string) === "single") ? "xl" : "default")}
      landmarkLabel={landmarkLabel}
    >
      <Grid cols={(((layout as string) === "split") ? "1-2" : "1")} className="items-start gap-8">
        <Form method="dialog" className="flex w-full flex-col gap-4" data-slot="reservation-form">
          <Field label={labels.name} htmlFor={tpl("{0}-name", id)}>
            <Input type="text" name="name" autoComplete="name" id={tpl("{0}-name", id)} data-slot="field" />
          </Field>
          <Field label={labels.phone} htmlFor={tpl("{0}-phone", id)}>
            <Input type="tel" name="phone" autoComplete="tel" id={tpl("{0}-phone", id)} data-slot="field" />
          </Field>
          {((fields as string) === "full") ? (
            <Field label={labels.email} htmlFor={tpl("{0}-email", id)}>
              <Input type="email" name="email" autoComplete="email" id={tpl("{0}-email", id)} data-slot="field" />
            </Field>
          ) : null}
          <Group gap="4" className="flex-wrap">
            <Box className="min-w-0 flex-1">
              <Field label={labels.date} htmlFor={tpl("{0}-date", id)}>
                <Input type="date" name="date" id={tpl("{0}-date", id)} data-slot="field" />
              </Field>
            </Box>
            <Box className="min-w-0 flex-1">
              <Field label={labels.time} htmlFor={tpl("{0}-time", id)}>
                <Input type="time" name="time" id={tpl("{0}-time", id)} data-slot="field" />
              </Field>
            </Box>
          </Group>
          <Stack gap="2">
            <Label className="text-xs font-bold text-foreground">
              {labels.guests}
            </Label>
            <NumberField
              value="2"
              name={tpl("{0}-guests", id)}
              min="1"
              label={labels.guests}
              decrease={labels.decrease}
              increase={labels.increase}
            />
          </Stack>
          {((fields as string) === "full") ? (
            <Field label={labels.notes} htmlFor={tpl("{0}-notes", id)}>
              <Textarea rows={4} name="notes" id={tpl("{0}-notes", id)} data-slot="field" />
            </Field>
          ) : null}
          {((terms as string) === "show") ? (
            <Group gap="2" align="center" className={cn("w-fit", "")}>
              <Checkbox name="consent" id={tpl("{0}-consent", id)} />
              <Label htmlFor={tpl("{0}-consent", id)} className="text-sm">
                {labels.consent}
              </Label>
            </Group>
          ) : null}
          <Button variant="default" size="default" type="submit" className="w-fit">
            {labels.submit}
          </Button>
        </Form>
        {(((layout as string) === "split") && ((details?.length ?? 0) > 0)) ? (
          <Stack gap="4" data-slot="details">
            {(details ?? []).map((d) => (
              <Group key={d.id} gap="4" align="start" data-slot="detail">
                <LucideIcon name={d.icon} size={20} />
                <Stack gap="0">
                  <Text size="base" weight="semibold">
                    {d.title}
                  </Text>
                  <Text size="sm" className="text-muted-foreground">
                    {d.text}
                  </Text>
                </Stack>
              </Group>
            ))}
          </Stack>
        ) : null}
      </Grid>
    </SectionFrame>
  );
}
blocks/reservation-form.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 ReservationLabels = {
  name: string;
  phone: string;
  email: string;
  date: string;
  time: string;
  guests: string;
  notes: string;
  consent: string;
  submit: string;
  decrease: string;
  increase: 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 reservation-form
blocks/reservation-form.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 ReservationLabels = {
  name: string;
  phone: string;
  email: string;
  date: string;
  time: string;
  guests: string;
  notes: string;
  consent: string;
  submit: string;
  decrease: string;
  increase: string;
};
blocks/reservation-form.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 table reservation: name, phone and/or email, date, time, guests, optional notes and consent; in the split
  layout, the ways to reach the house sit beside the form. Axes: layout (single, split), density, fields (full,
  compact).
-->
<script lang="ts">
import type { ReservationLabels } from "./reservation-form.types";
import type { Feature } from "./feature-grid.types";

export type ReservationFormProps = {
  id: string;
  title: string;
  text: string;
  labels: ReservationLabels;
  details: Feature[];
  layout?: "single" | "split";
  fields?: "full" | "compact";
  terms?: "show" | "hide";
  density?: "default" | "compact";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Button from "../compose/Button.vue";
import Checkbox from "../compose/Checkbox.vue";
import Form from "../compose/Form.vue";
import Grid from "../compose/Grid.vue";
import Group from "../compose/Group.vue";
import Input from "../compose/Input.vue";
import Label from "../compose/Label.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Textarea from "../compose/Textarea.vue";
import Field from "../components/field.vue";
import NumberField from "../components/number-field.vue";
import SectionFrame from "../components/section-frame.vue";
import { cn, tpl } from "../utils";

const {
  id,
  title,
  text,
  labels,
  details,
  layout = "single",
  fields = "full",
  terms = "hide",
  density = "default",
  landmarkLabel,
} = defineProps<ReservationFormProps>();
</script>

<template>
  <SectionFrame
    :id="id"
    :title="title"
    :lead="text"
    :density="density"
    :measure="(((layout as string) === 'single') ? 'xl' : 'default')"
    :landmarkLabel="landmarkLabel"
  >
    <Grid :cols="(((layout as string) === 'split') ? '1-2' : '1')" class="items-start gap-8">
      <Form method="dialog" class="flex w-full flex-col gap-4" data-slot="reservation-form">
        <Field :label="labels.name" :htmlFor="tpl('{0}-name', id)">
          <Input type="text" name="name" autocomplete="name" :id="tpl('{0}-name', id)" data-slot="field" />
        </Field>
        <Field :label="labels.phone" :htmlFor="tpl('{0}-phone', id)">
          <Input type="tel" name="phone" autocomplete="tel" :id="tpl('{0}-phone', id)" data-slot="field" />
        </Field>
        <Field v-if="((fields as string) === 'full')" :label="labels.email" :htmlFor="tpl('{0}-email', id)">
          <Input type="email" name="email" autocomplete="email" :id="tpl('{0}-email', id)" data-slot="field" />
        </Field>
        <Group gap="4" class="flex-wrap">
          <Box class="min-w-0 flex-1">
            <Field :label="labels.date" :htmlFor="tpl('{0}-date', id)">
              <Input type="date" name="date" :id="tpl('{0}-date', id)" data-slot="field" />
            </Field>
          </Box>
          <Box class="min-w-0 flex-1">
            <Field :label="labels.time" :htmlFor="tpl('{0}-time', id)">
              <Input type="time" name="time" :id="tpl('{0}-time', id)" data-slot="field" />
            </Field>
          </Box>
        </Group>
        <Stack gap="2">
          <Label class="text-xs font-bold text-foreground">
            {{ labels.guests }}
          </Label>
          <NumberField
            value="2"
            :name="tpl('{0}-guests', id)"
            min="1"
            :label="labels.guests"
            :decrease="labels.decrease"
            :increase="labels.increase"
          />
        </Stack>
        <Field v-if="((fields as string) === 'full')" :label="labels.notes" :htmlFor="tpl('{0}-notes', id)">
          <Textarea :rows="4" name="notes" :id="tpl('{0}-notes', id)" data-slot="field" />
        </Field>
        <Group v-if="((terms as string) === 'show')" gap="2" align="center" :class="cn('w-fit', '')">
          <Checkbox name="consent" :id="tpl('{0}-consent', id)" />
          <Label :for="tpl('{0}-consent', id)" class="text-sm">
            {{ labels.consent }}
          </Label>
        </Group>
        <Button variant="default" size="default" type="submit" class="w-fit">
          {{ labels.submit }}
        </Button>
      </Form>
      <Stack v-if="(((layout as string) === 'split') && ((details?.length ?? 0) > 0))" gap="4" data-slot="details">
        <Group v-for="d in details" :key="d.id" gap="4" align="start" data-slot="detail">
          <LucideIcon :name="d.icon" :size="20" />
          <Stack gap="0">
            <Text size="base" weight="semibold">
              {{ d.title }}
            </Text>
            <Text size="sm" class="text-muted-foreground">
              {{ d.text }}
            </Text>
          </Stack>
        </Group>
      </Stack>
    </Grid>
  </SectionFrame>
</template>

Vue registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdn
npx ui8kit add reservation-form
blocks/reservation-form.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 table reservation: name, phone and/or email, date, time, guests, optional notes and consent; in the split
 * layout, the ways to reach the house sit beside the form. Axes: layout (single, split), density, fields (full,
 * compact).
 */
import { For, type JSX } from "solid-js";
import { Box, Button, Checkbox, Form, Grid, Group, Input, Label, Stack, Text, Textarea } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { Field } from "../components/field";
import { NumberField } from "../components/number-field";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { ReservationLabels } from "./reservation-form.types";
import type { Feature } from "./feature-grid.types";

export type ReservationFormProps = {
  id: string;
  title: string;
  text: string;
  labels: ReservationLabels;
  details: Feature[];
  layout?: "single" | "split";
  fields?: "full" | "compact";
  terms?: "show" | "hide";
  density?: "default" | "compact";
  landmarkLabel?: string;
};

export function ReservationForm({
  id,
  title,
  text,
  labels,
  details,
  layout = "single",
  fields = "full",
  terms = "hide",
  density = "default",
  landmarkLabel,
}: ReservationFormProps) {
  return (
    <SectionFrame
      id={id}
      title={title}
      lead={text}
      density={density}
      measure={(((layout as string) === "single") ? "xl" : "default")}
      landmarkLabel={landmarkLabel}
    >
      <Grid cols={(((layout as string) === "split") ? "1-2" : "1")} class="items-start gap-8">
        <Form method="dialog" class="flex w-full flex-col gap-4" data-slot="reservation-form">
          <Field label={labels.name} htmlFor={tpl("{0}-name", id)}>
            <Input type="text" name="name" autocomplete="name" id={tpl("{0}-name", id)} data-slot="field" />
          </Field>
          <Field label={labels.phone} htmlFor={tpl("{0}-phone", id)}>
            <Input type="tel" name="phone" autocomplete="tel" id={tpl("{0}-phone", id)} data-slot="field" />
          </Field>
          {((fields as string) === "full") ? (
            <Field label={labels.email} htmlFor={tpl("{0}-email", id)}>
              <Input type="email" name="email" autocomplete="email" id={tpl("{0}-email", id)} data-slot="field" />
            </Field>
          ) : null}
          <Group gap="4" class="flex-wrap">
            <Box class="min-w-0 flex-1">
              <Field label={labels.date} htmlFor={tpl("{0}-date", id)}>
                <Input type="date" name="date" id={tpl("{0}-date", id)} data-slot="field" />
              </Field>
            </Box>
            <Box class="min-w-0 flex-1">
              <Field label={labels.time} htmlFor={tpl("{0}-time", id)}>
                <Input type="time" name="time" id={tpl("{0}-time", id)} data-slot="field" />
              </Field>
            </Box>
          </Group>
          <Stack gap="2">
            <Label class="text-xs font-bold text-foreground">
              {labels.guests}
            </Label>
            <NumberField
              value="2"
              name={tpl("{0}-guests", id)}
              min="1"
              label={labels.guests}
              decrease={labels.decrease}
              increase={labels.increase}
            />
          </Stack>
          {((fields as string) === "full") ? (
            <Field label={labels.notes} htmlFor={tpl("{0}-notes", id)}>
              <Textarea rows={4} name="notes" id={tpl("{0}-notes", id)} data-slot="field" />
            </Field>
          ) : null}
          {((terms as string) === "show") ? (
            <Group gap="2" align="center" class={cn("w-fit", "")}>
              <Checkbox name="consent" id={tpl("{0}-consent", id)} />
              <Label for={tpl("{0}-consent", id)} class="text-sm">
                {labels.consent}
              </Label>
            </Group>
          ) : null}
          <Button variant="default" size="default" type="submit" class="w-fit">
            {labels.submit}
          </Button>
        </Form>
        {(((layout as string) === "split") && ((details?.length ?? 0) > 0)) ? (
          <Stack gap="4" data-slot="details">
            <For each={details ?? []}>{(d) => (
              <Group gap="4" align="start" data-slot="detail">
                <LucideIcon name={d.icon} size={20} />
                <Stack gap="0">
                  <Text size="base" weight="semibold">
                    {d.title}
                  </Text>
                  <Text size="sm" class="text-muted-foreground">
                    {d.text}
                  </Text>
                </Stack>
              </Group>
            )}</For>
          </Stack>
        ) : null}
      </Grid>
    </SectionFrame>
  );
}
blocks/reservation-form.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 ReservationLabels = {
  name: string;
  phone: string;
  email: string;
  date: string;
  time: string;
  guests: string;
  notes: string;
  consent: string;
  submit: string;
  decrease: string;
  increase: 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 reservation-form
blocks/reservation-form.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/reservation-form.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/ui/button"
	"github.com/ui8kit/codegen/generated/templ/ui/checkbox"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/ui/form"
	"github.com/ui8kit/codegen/generated/templ/icons"
	"github.com/ui8kit/codegen/generated/templ/ui/input"
	"github.com/ui8kit/codegen/generated/templ/ui/label"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	"github.com/ui8kit/codegen/generated/templ/ui/textarea"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// ReservationFormProps are the props of ReservationForm; the values are the JSON shapes of the TypeScript props.
type ReservationFormProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Text any `json:"text"`
	Labels any `json:"labels"`
	Details any `json:"details"`
	Layout any `json:"layout"`
	Fields any `json:"fields"`
	Terms any `json:"terms"`
	Density any `json:"density"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A table reservation: name, phone and/or email, date, time, guests, optional notes and consent; in the split layout, the ways to reach the house sit beside the form. Axes: layout (single, split), density, fields (full, compact).
templ ReservationForm(p ReservationFormProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vText := p.Text }}
	{{ vLabels := p.Labels }}
	{{ vDetails := p.Details }}
	{{ vLayout := uiutils.Def(p.Layout, "single") }}
	{{ vFields := uiutils.Def(p.Fields, "full") }}
	{{ vTerms := uiutils.Def(p.Terms, "hide") }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vText, Density: vDensity, Measure: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "single")), "xl", "default"), LandmarkLabel: vLandmarkLabel}) {
		@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "1-2", "1")), BoxProps: box.BoxProps{Class: "items-start gap-8"}}) {
			@compose.Form(compose.FormProps{FormProps: form.FormProps{Method: "dialog", Class: "flex w-full flex-col gap-4", Attrs: uiutils.Attrs("data-slot", "reservation-form")}}) {
				@Field(FieldProps{Label: uiutils.Get(vLabels, "name"), HtmlFor: uiutils.Tpl("{0}-name", vId)}) {
					@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: "name", Attrs: uiutils.Attrs("autocomplete", "name", "id", uiutils.Tpl("{0}-name", vId), "data-slot", "field")}})
				}
				@Field(FieldProps{Label: uiutils.Get(vLabels, "phone"), HtmlFor: uiutils.Tpl("{0}-phone", vId)}) {
					@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "tel", Name: "phone", Attrs: uiutils.Attrs("autocomplete", "tel", "id", uiutils.Tpl("{0}-phone", vId), "data-slot", "field")}})
				}
				if uiutils.Eq(vFields, "full") {
					@Field(FieldProps{Label: uiutils.Get(vLabels, "email"), HtmlFor: uiutils.Tpl("{0}-email", vId)}) {
						@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "email", Name: "email", Attrs: uiutils.Attrs("autocomplete", "email", "id", uiutils.Tpl("{0}-email", vId), "data-slot", "field")}})
					}
				}
				@compose.Group(compose.GroupProps{Gap: "4", BoxProps: box.BoxProps{Class: "flex-wrap"}}) {
					@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "min-w-0 flex-1"}}) {
						@Field(FieldProps{Label: uiutils.Get(vLabels, "date"), HtmlFor: uiutils.Tpl("{0}-date", vId)}) {
							@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "date", Name: "date", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-date", vId), "data-slot", "field")}})
						}
					}
					@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "min-w-0 flex-1"}}) {
						@Field(FieldProps{Label: uiutils.Get(vLabels, "time"), HtmlFor: uiutils.Tpl("{0}-time", vId)}) {
							@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "time", Name: "time", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-time", vId), "data-slot", "field")}})
						}
					}
				}
				@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{}}) {
					@compose.Label(compose.LabelProps{LabelProps: label.LabelProps{Class: "text-xs font-bold text-foreground"}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "guests")) }
					}
					@NumberField(NumberFieldProps{Value: "2", Name: uiutils.Tpl("{0}-guests", vId), Min: "1", Label: uiutils.Get(vLabels, "guests"), Decrease: uiutils.Get(vLabels, "decrease"), Increase: uiutils.Get(vLabels, "increase")})
				}
				if uiutils.Eq(vFields, "full") {
					@Field(FieldProps{Label: uiutils.Get(vLabels, "notes"), HtmlFor: uiutils.Tpl("{0}-notes", vId)}) {
						@compose.Textarea(compose.TextareaProps{TextareaProps: textarea.TextareaProps{Rows: "4", Name: "notes", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-notes", vId), "data-slot", "field")}})
					}
				}
				if uiutils.Eq(vTerms, "show") {
					@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("w-fit", ""))}}) {
						@compose.Checkbox(compose.CheckboxProps{CheckboxProps: checkbox.CheckboxProps{Name: "consent", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-consent", vId))}})
						@compose.Label(compose.LabelProps{LabelProps: label.LabelProps{For: uiutils.S(uiutils.Tpl("{0}-consent", vId)), Class: "text-sm"}}) {
							{ uiutils.Text(uiutils.Get(vLabels, "consent")) }
						}
					}
				}
				@compose.Button(compose.ButtonProps{Variant: "default", Size: "default", ButtonProps: button.ButtonProps{Type: "submit", Class: "w-fit"}}) {
					{ uiutils.Text(uiutils.Get(vLabels, "submit")) }
				}
			}
			if uiutils.T(uiutils.And(uiutils.Eq(vLayout, "split"), uiutils.Gt(uiutils.Len(vDetails), float64(0)))) {
				@compose.Stack(compose.StackProps{Gap: "4", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "details")}}) {
					for _, vD := range uiutils.L(vDetails) {
						@compose.Group(compose.GroupProps{Gap: "4", Align: "start", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "detail")}}) {
							@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vD, "icon")), Size: 20})
							@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{}}) {
								@compose.Text(compose.TextProps{Size: "base", Weight: "semibold", TextProps: text.TextProps{}}) {
									{ uiutils.Text(uiutils.Get(vD, "title")) }
								}
								@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
									{ uiutils.Text(uiutils.Get(vD, "text")) }
								}
							}
						}
					}
				}
			}
		}
	}
}

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 reservation-form
blocks/reservation-form.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/reservation-form.json
    A table reservation: name, phone and/or email, date, time, guests, optional notes and consent; in the split layout, the ways to reach the house sit beside the form. Axes: layout (single, split), density, fields (full, compact).
    Props (p): id, title, text, labels, details, layout, fields, terms, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_details = (p.details ?? null) -%}
{%- set v_layout = (p.layout ?? 'single') -%}
{%- set v_fields = (p.fields ?? 'full') -%}
{%- set v_terms = (p.terms ?? 'hide') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_22 -%}
  {%- set c_21 -%}
    {%- set c_15 -%}
      {%- set c_1 -%}
        {{ include('compose/Input.html.twig', {'type': 'text', 'name': 'name', 'attrs': og_attrs(['autocomplete', 'name', 'id', og_tpl('{0}-name', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
      {%- endset -%}
      {{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['name']), 'htmlFor': og_tpl('{0}-name', [v_id])}, 'children': og_markup(c_1)}, with_context = false) }}
      {%- set c_2 -%}
        {{ include('compose/Input.html.twig', {'type': 'tel', 'name': 'phone', 'attrs': og_attrs(['autocomplete', 'tel', 'id', og_tpl('{0}-phone', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
      {%- endset -%}
      {{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['phone']), 'htmlFor': og_tpl('{0}-phone', [v_id])}, 'children': og_markup(c_2)}, with_context = false) }}
      {%- if og_t(og_eq(v_fields, 'full')) %}
        {%- set c_3 -%}
          {{ include('compose/Input.html.twig', {'type': 'email', 'name': 'email', 'attrs': og_attrs(['autocomplete', 'email', 'id', og_tpl('{0}-email', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
        {%- endset -%}
        {{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['email']), 'htmlFor': og_tpl('{0}-email', [v_id])}, 'children': og_markup(c_3)}, with_context = false) }}
      {%- endif %}
      {%- set c_8 -%}
        {%- set c_5 -%}
          {%- set c_4 -%}
            {{ include('compose/Input.html.twig', {'type': 'date', 'name': 'date', 'attrs': og_attrs(['id', og_tpl('{0}-date', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
          {%- endset -%}
          {{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['date']), 'htmlFor': og_tpl('{0}-date', [v_id])}, 'children': og_markup(c_4)}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Box.html.twig', {'class': 'min-w-0 flex-1', 'children': c_5}, with_context = false) }}
        {%- set c_7 -%}
          {%- set c_6 -%}
            {{ include('compose/Input.html.twig', {'type': 'time', 'name': 'time', 'attrs': og_attrs(['id', og_tpl('{0}-time', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
          {%- endset -%}
          {{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['time']), 'htmlFor': og_tpl('{0}-time', [v_id])}, 'children': og_markup(c_6)}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Box.html.twig', {'class': 'min-w-0 flex-1', 'children': c_7}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Group.html.twig', {'gap': '4', 'class': 'flex-wrap', 'children': c_8}, with_context = false) }}
      {%- set c_10 -%}
        {%- set c_9 -%}
          {{ og_text(og_get(v_labels, ['guests'])) }}
        {%- endset -%}
        {{ include('compose/Label.html.twig', {'class': 'text-xs font-bold text-foreground', 'children': c_9}, with_context = false) }}
        {{ include('blocks/number-field.html.twig', {'p': {'value': '2', 'name': og_tpl('{0}-guests', [v_id]), 'min': '1', 'label': og_get(v_labels, ['guests']), 'decrease': og_get(v_labels, ['decrease']), 'increase': og_get(v_labels, ['increase'])}}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Stack.html.twig', {'gap': '2', 'children': c_10}, with_context = false) }}
      {%- if og_t(og_eq(v_fields, 'full')) %}
        {%- set c_11 -%}
          {{ include('compose/Textarea.html.twig', {'rows': 4, 'name': 'notes', 'attrs': og_attrs(['id', og_tpl('{0}-notes', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
        {%- endset -%}
        {{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['notes']), 'htmlFor': og_tpl('{0}-notes', [v_id])}, 'children': og_markup(c_11)}, with_context = false) }}
      {%- endif %}
      {%- if og_t(og_eq(v_terms, 'show')) %}
        {%- set c_13 -%}
          {{ include('compose/Checkbox.html.twig', {'name': 'consent', 'attrs': og_attrs(['id', og_tpl('{0}-consent', [v_id])])}, with_context = false) }}
          {%- set c_12 -%}
            {{ og_text(og_get(v_labels, ['consent'])) }}
          {%- endset -%}
          {{ include('compose/Label.html.twig', {'htmlFor': og_s(og_tpl('{0}-consent', [v_id])), 'class': 'text-sm', 'children': c_12}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'class': og_s(og_cnv(['w-fit', ''])), 'children': c_13}, with_context = false) }}
      {%- endif %}
      {%- set c_14 -%}
        {{ og_text(og_get(v_labels, ['submit'])) }}
      {%- endset -%}
      {{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'default', 'type': 'submit', 'class': 'w-fit', 'children': c_14}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Form.html.twig', {'method': 'dialog', 'class': 'flex w-full flex-col gap-4', 'attrs': og_attrs(['data-slot', 'reservation-form']), 'children': c_15}, with_context = false) }}
    {%- if og_t(og_and([og_eq(v_layout, 'split'), og_gt(og_len(v_details), 0)])) %}
      {%- set c_20 -%}
        {%- for v_d in og_l(v_details) %}
          {%- set c_19 -%}
            {{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_d, ['icon'])), 'size': 20}, with_context = false) }}
            {%- set c_18 -%}
              {%- set c_16 -%}
                {{ og_text(og_get(v_d, ['title'])) }}
              {%- endset -%}
              {{ include('compose/Text.html.twig', {'size': 'base', 'weight': 'semibold', 'children': c_16}, with_context = false) }}
              {%- set c_17 -%}
                {{ og_text(og_get(v_d, ['text'])) }}
              {%- endset -%}
              {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_17}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Stack.html.twig', {'gap': '0', 'children': c_18}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'start', 'attrs': og_attrs(['data-slot', 'detail']), 'children': c_19}, with_context = false) }}
        {%- endfor %}
      {%- endset -%}
      {{ include('compose/Stack.html.twig', {'gap': '4', 'attrs': og_attrs(['data-slot', 'details']), 'children': c_20}, with_context = false) }}
    {%- endif %}
  {%- endset -%}
  {{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_layout, 'split')) ? '1-2' : '1')), 'class': 'items-start gap-8', 'children': c_21}, with_context = false) }}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_text, 'density': v_density, 'measure': (og_t(og_eq(v_layout, 'single')) ? 'xl' : 'default'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_22)}, 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 reservation-form
blocks/reservation-form.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/reservation-form.json
    A table reservation: name, phone and/or email, date, time, guests, optional notes and consent; in the split layout, the ways to reach the house sit beside the form. Axes: layout (single, split), density, fields (full, compact).
    Props (p): id, title, text, labels, details, layout, fields, terms, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_details = ($p['details'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'single')}
{var $v_fields = ($p['fields'] ?? 'full')}
{var $v_terms = ($p['terms'] ?? 'hide')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_22}
  {capture $c_21}
    {capture $c_15}
      {capture $c_1}
        {=og_include('compose/Input.latte', ['type' => 'text', 'name' => 'name', 'attrs' => og_attrs(['autocomplete', 'name', 'id', og_tpl('{0}-name', [$v_id]), 'data-slot', 'field'])])|noescape}
      {/capture}
      {=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['name']), 'htmlFor' => og_tpl('{0}-name', [$v_id])], 'children' => og_markup($c_1)])|noescape}
      {capture $c_2}
        {=og_include('compose/Input.latte', ['type' => 'tel', 'name' => 'phone', 'attrs' => og_attrs(['autocomplete', 'tel', 'id', og_tpl('{0}-phone', [$v_id]), 'data-slot', 'field'])])|noescape}
      {/capture}
      {=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['phone']), 'htmlFor' => og_tpl('{0}-phone', [$v_id])], 'children' => og_markup($c_2)])|noescape}
      {if og_t(og_eq($v_fields, 'full'))}
        {capture $c_3}
          {=og_include('compose/Input.latte', ['type' => 'email', 'name' => 'email', 'attrs' => og_attrs(['autocomplete', 'email', 'id', og_tpl('{0}-email', [$v_id]), 'data-slot', 'field'])])|noescape}
        {/capture}
        {=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['email']), 'htmlFor' => og_tpl('{0}-email', [$v_id])], 'children' => og_markup($c_3)])|noescape}
      {/if}
      {capture $c_8}
        {capture $c_5}
          {capture $c_4}
            {=og_include('compose/Input.latte', ['type' => 'date', 'name' => 'date', 'attrs' => og_attrs(['id', og_tpl('{0}-date', [$v_id]), 'data-slot', 'field'])])|noescape}
          {/capture}
          {=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['date']), 'htmlFor' => og_tpl('{0}-date', [$v_id])], 'children' => og_markup($c_4)])|noescape}
        {/capture}
        {=og_include('compose/Box.latte', ['class' => 'min-w-0 flex-1', 'children' => (string) $c_5])|noescape}
        {capture $c_7}
          {capture $c_6}
            {=og_include('compose/Input.latte', ['type' => 'time', 'name' => 'time', 'attrs' => og_attrs(['id', og_tpl('{0}-time', [$v_id]), 'data-slot', 'field'])])|noescape}
          {/capture}
          {=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['time']), 'htmlFor' => og_tpl('{0}-time', [$v_id])], 'children' => og_markup($c_6)])|noescape}
        {/capture}
        {=og_include('compose/Box.latte', ['class' => 'min-w-0 flex-1', 'children' => (string) $c_7])|noescape}
      {/capture}
      {=og_include('compose/Group.latte', ['gap' => '4', 'class' => 'flex-wrap', 'children' => (string) $c_8])|noescape}
      {capture $c_10}
        {capture $c_9}
          {=og_text(og_get($v_labels, ['guests']))}
        {/capture}
        {=og_include('compose/Label.latte', ['class' => 'text-xs font-bold text-foreground', 'children' => (string) $c_9])|noescape}
        {=og_include('blocks/number-field.latte', ['p' => ['value' => '2', 'name' => og_tpl('{0}-guests', [$v_id]), 'min' => '1', 'label' => og_get($v_labels, ['guests']), 'decrease' => og_get($v_labels, ['decrease']), 'increase' => og_get($v_labels, ['increase'])]])|noescape}
      {/capture}
      {=og_include('compose/Stack.latte', ['gap' => '2', 'children' => (string) $c_10])|noescape}
      {if og_t(og_eq($v_fields, 'full'))}
        {capture $c_11}
          {=og_include('compose/Textarea.latte', ['rows' => 4, 'name' => 'notes', 'attrs' => og_attrs(['id', og_tpl('{0}-notes', [$v_id]), 'data-slot', 'field'])])|noescape}
        {/capture}
        {=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['notes']), 'htmlFor' => og_tpl('{0}-notes', [$v_id])], 'children' => og_markup($c_11)])|noescape}
      {/if}
      {if og_t(og_eq($v_terms, 'show'))}
        {capture $c_13}
          {=og_include('compose/Checkbox.latte', ['name' => 'consent', 'attrs' => og_attrs(['id', og_tpl('{0}-consent', [$v_id])])])|noescape}
          {capture $c_12}
            {=og_text(og_get($v_labels, ['consent']))}
          {/capture}
          {=og_include('compose/Label.latte', ['htmlFor' => og_s(og_tpl('{0}-consent', [$v_id])), 'class' => 'text-sm', 'children' => (string) $c_12])|noescape}
        {/capture}
        {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'class' => og_s(og_cnv(['w-fit', ''])), 'children' => (string) $c_13])|noescape}
      {/if}
      {capture $c_14}
        {=og_text(og_get($v_labels, ['submit']))}
      {/capture}
      {=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'default', 'type' => 'submit', 'class' => 'w-fit', 'children' => (string) $c_14])|noescape}
    {/capture}
    {=og_include('compose/Form.latte', ['method' => 'dialog', 'class' => 'flex w-full flex-col gap-4', 'attrs' => og_attrs(['data-slot', 'reservation-form']), 'children' => (string) $c_15])|noescape}
    {if og_t(og_and([og_eq($v_layout, 'split'), og_gt(og_len($v_details), 0)]))}
      {capture $c_20}
        {foreach og_l($v_details) as $v_d}
          {capture $c_19}
            {=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_d, ['icon'])), 'size' => 20])|noescape}
            {capture $c_18}
              {capture $c_16}
                {=og_text(og_get($v_d, ['title']))}
              {/capture}
              {=og_include('compose/Text.latte', ['size' => 'base', 'weight' => 'semibold', 'children' => (string) $c_16])|noescape}
              {capture $c_17}
                {=og_text(og_get($v_d, ['text']))}
              {/capture}
              {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_17])|noescape}
            {/capture}
            {=og_include('compose/Stack.latte', ['gap' => '0', 'children' => (string) $c_18])|noescape}
          {/capture}
          {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'start', 'attrs' => og_attrs(['data-slot', 'detail']), 'children' => (string) $c_19])|noescape}
        {/foreach}
      {/capture}
      {=og_include('compose/Stack.latte', ['gap' => '4', 'attrs' => og_attrs(['data-slot', 'details']), 'children' => (string) $c_20])|noescape}
    {/if}
  {/capture}
  {=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_layout, 'split')) ? '1-2' : '1')), 'class' => 'items-start gap-8', 'children' => (string) $c_21])|noescape}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_text, 'density' => $v_density, 'measure' => (og_t(og_eq($v_layout, 'single')) ? 'xl' : 'default'), 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_22)])|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 reservation-form
blocks/reservation-form.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/reservation-form.json
    A table reservation: name, phone and/or email, date, time, guests, optional notes and consent; in the split layout, the ways to reach the house sit beside the form. Axes: layout (single, split), density, fields (full, compact).
    Props (p): id, title, text, labels, details, layout, fields, terms, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_text = og_def(p['text'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_details = og_def(p['details'], none) -%}
{%- set v_layout = og_def(p['layout'], 'single') -%}
{%- set v_fields = og_def(p['fields'], 'full') -%}
{%- set v_terms = og_def(p['terms'], 'hide') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_22 -%}
  {%- set c_21 -%}
    {%- set c_15 -%}
      {%- set c_1 -%}
        {{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': 'name', 'Attrs': og_attrs(['autocomplete', 'name', 'id', og_tpl('{0}-name', [v_id]), 'data-slot', 'field'])}}) }}
      {%- endset -%}
      {{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['name']), 'htmlFor': og_tpl('{0}-name', [v_id])}, 'children': og_markup(c_1)}) }}
      {%- set c_2 -%}
        {{ og_include('compose/input.html.j2', {'p': {'Type': 'tel', 'Name': 'phone', 'Attrs': og_attrs(['autocomplete', 'tel', 'id', og_tpl('{0}-phone', [v_id]), 'data-slot', 'field'])}}) }}
      {%- endset -%}
      {{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['phone']), 'htmlFor': og_tpl('{0}-phone', [v_id])}, 'children': og_markup(c_2)}) }}
      {%- if og_t(og_eq(v_fields, 'full')) %}
        {%- set c_3 -%}
          {{ og_include('compose/input.html.j2', {'p': {'Type': 'email', 'Name': 'email', 'Attrs': og_attrs(['autocomplete', 'email', 'id', og_tpl('{0}-email', [v_id]), 'data-slot', 'field'])}}) }}
        {%- endset -%}
        {{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['email']), 'htmlFor': og_tpl('{0}-email', [v_id])}, 'children': og_markup(c_3)}) }}
      {%- endif %}
      {%- set c_8 -%}
        {%- set c_5 -%}
          {%- set c_4 -%}
            {{ og_include('compose/input.html.j2', {'p': {'Type': 'date', 'Name': 'date', 'Attrs': og_attrs(['id', og_tpl('{0}-date', [v_id]), 'data-slot', 'field'])}}) }}
          {%- endset -%}
          {{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['date']), 'htmlFor': og_tpl('{0}-date', [v_id])}, 'children': og_markup(c_4)}) }}
        {%- endset -%}
        {{ og_include('compose/box.html.j2', {'p': {'Class': 'min-w-0 flex-1'}, 'children': c_5}) }}
        {%- set c_7 -%}
          {%- set c_6 -%}
            {{ og_include('compose/input.html.j2', {'p': {'Type': 'time', 'Name': 'time', 'Attrs': og_attrs(['id', og_tpl('{0}-time', [v_id]), 'data-slot', 'field'])}}) }}
          {%- endset -%}
          {{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['time']), 'htmlFor': og_tpl('{0}-time', [v_id])}, 'children': og_markup(c_6)}) }}
        {%- endset -%}
        {{ og_include('compose/box.html.j2', {'p': {'Class': 'min-w-0 flex-1'}, 'children': c_7}) }}
      {%- endset -%}
      {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Class': 'flex-wrap'}, 'children': c_8}) }}
      {%- set c_10 -%}
        {%- set c_9 -%}
          {{ og_text(og_get(v_labels, ['guests'])) }}
        {%- endset -%}
        {{ og_include('compose/label.html.j2', {'p': {'Class': 'text-xs font-bold text-foreground'}, 'children': c_9}) }}
        {{ og_include('blocks/number-field.html.j2', {'p': {'value': '2', 'name': og_tpl('{0}-guests', [v_id]), 'min': '1', 'label': og_get(v_labels, ['guests']), 'decrease': og_get(v_labels, ['decrease']), 'increase': og_get(v_labels, ['increase'])}}) }}
      {%- endset -%}
      {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2'}, 'children': c_10}) }}
      {%- if og_t(og_eq(v_fields, 'full')) %}
        {%- set c_11 -%}
          {{ og_include('compose/textarea.html.j2', {'p': {'Rows': 4, 'Name': 'notes', 'Attrs': og_attrs(['id', og_tpl('{0}-notes', [v_id]), 'data-slot', 'field'])}}) }}
        {%- endset -%}
        {{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['notes']), 'htmlFor': og_tpl('{0}-notes', [v_id])}, 'children': og_markup(c_11)}) }}
      {%- endif %}
      {%- if og_t(og_eq(v_terms, 'show')) %}
        {%- set c_13 -%}
          {{ og_include('compose/checkbox.html.j2', {'p': {'Name': 'consent', 'Attrs': og_attrs(['id', og_tpl('{0}-consent', [v_id])])}}) }}
          {%- set c_12 -%}
            {{ og_text(og_get(v_labels, ['consent'])) }}
          {%- endset -%}
          {{ og_include('compose/label.html.j2', {'p': {'For': og_s(og_tpl('{0}-consent', [v_id])), 'Class': 'text-sm'}, 'children': c_12}) }}
        {%- endset -%}
        {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Class': og_s(og_cnv(['w-fit', '']))}, 'children': c_13}) }}
      {%- endif %}
      {%- set c_14 -%}
        {{ og_text(og_get(v_labels, ['submit'])) }}
      {%- endset -%}
      {{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'default', 'Type': 'submit', 'Class': 'w-fit'}, 'children': c_14}) }}
    {%- endset -%}
    {{ og_include('compose/form.html.j2', {'p': {'Method': 'dialog', 'Class': 'flex w-full flex-col gap-4', 'Attrs': og_attrs(['data-slot', 'reservation-form'])}, 'children': c_15}) }}
    {%- if og_t(og_and([og_eq(v_layout, 'split'), og_gt(og_len(v_details), 0)])) %}
      {%- set c_20 -%}
        {%- for v_d in og_l(v_details) %}
          {%- set c_19 -%}
            {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_d, ['icon'])), 'Size': 20}}) }}
            {%- set c_18 -%}
              {%- set c_16 -%}
                {{ og_text(og_get(v_d, ['title'])) }}
              {%- endset -%}
              {{ og_include('compose/text.html.j2', {'p': {'Size': 'base', 'Weight': 'semibold'}, 'children': c_16}) }}
              {%- set c_17 -%}
                {{ og_text(og_get(v_d, ['text'])) }}
              {%- endset -%}
              {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_17}) }}
            {%- endset -%}
            {{ og_include('compose/stack.html.j2', {'p': {'Gap': '0'}, 'children': c_18}) }}
          {%- endset -%}
          {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'start', 'Attrs': og_attrs(['data-slot', 'detail'])}, 'children': c_19}) }}
        {%- endfor %}
      {%- endset -%}
      {{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Attrs': og_attrs(['data-slot', 'details'])}, 'children': c_20}) }}
    {%- endif %}
  {%- endset -%}
  {{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('1-2' if og_t(og_eq(v_layout, 'split')) else '1')), 'Class': 'items-start gap-8'}, 'children': c_21}) }}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_text, 'density': v_density, 'measure': ('xl' if og_t(og_eq(v_layout, 'single')) else 'default'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_22)}) }}

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 table reservation: name, phone and/or email, date, time, guests, optional notes and consent; in the split layout, the ways to reach the house sit beside the form. Axes: layout (single, split), density, fields (full, compact).

Props of ReservationForm
PropTypeDefault Description
id (required)string-
title (required)string-
text (required)string-
labels (required)ReservationLabels-
details (required)Feature[]-address, hours and phone, shown beside the form in the split layout; Codex kind `contact`
layout "single" | "split""single"
fields "full" | "compact""full"
terms "show" | "hide""hide"
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