Checkout Form
Contacts, address, a window and the payment beside a sticky order summary.
Install
npx ui8kit add checkout-formPulls in: box, cart-list, cart-summary-card, checkout-step, checkout-submit, compose, field, form, grid, input, kit-box, kit-form, kit-input, kit-textarea, order-summary, payment-options, section-frame, slot-grid, textarea, utils
Preview
Checkout
Order summary
3 products
- $89
Arc desk lamp
1 x $89
- $129
Field backpack
1 x $129
- $70
Desk mat
2 x $35
Try:
WELCOME10FREESHIPDESK15Add $12 more for free express delivery
- Subtotal$288
- Shipping$12
- Tax$24
- Total$324
Taxes are calculated at checkout.
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 checkout-form<!-- 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 checkout on one page: contacts, address, a delivery window, the payment and the consent as stacked steps,
beside a sticky order summary with the lines, a promo code and the totals. Static markup. Axes: layout (cards:
each step in a card, numbered: numbered steps divided by a line), summary (aside, none), tone.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { CheckoutLabels } from "./checkout-form.types";
import type { Day } from "../components/slot-grid.types";
import type { Payment } from "../components/payment-options.types";
import type { CartLine } from "./cart-list.types";
import type { SummaryRow } from "./order-summary.types";
import type { Promo, CartSummaryLabels } from "../components/cart-summary-card.types";
export type CheckoutFormProps = {
id: string;
title?: string;
days: Day[];
payments: Payment[];
lines: CartLine[];
rows: SummaryRow[];
promos: Promo[];
labels: CheckoutLabels;
totals: CartSummaryLabels;
layout?: "cards" | "numbered";
summary?: "aside" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Form from "../compose/Form.svelte";
import Grid from "../compose/Grid.svelte";
import Input from "../compose/Input.svelte";
import Textarea from "../compose/Textarea.svelte";
import CartSummaryCard from "../components/cart-summary-card.svelte";
import CheckoutStep from "../components/checkout-step.svelte";
import CheckoutSubmit from "../components/checkout-submit.svelte";
import Field from "../components/field.svelte";
import PaymentOptions from "../components/payment-options.svelte";
import SectionFrame from "../components/section-frame.svelte";
import SlotGrid from "../components/slot-grid.svelte";
import { tpl } from "../utils";
let {
id,
title = "",
days,
payments,
lines,
rows,
promos,
labels,
totals,
layout = "cards",
summary = "aside",
tone = "default",
landmarkLabel,
}: CheckoutFormProps = $props();
</script>
<SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
<Box class="grid grid-cols-1 items-start gap-8 lg:grid-cols-3">
<Form
method="dialog"
class={
(summary as string) === "aside" ? "flex flex-col gap-6 lg:col-span-2"
: "flex flex-col gap-6 lg:col-span-3"
}
data-slot="checkout-form"
>
<CheckoutStep number="1" title={labels.contacts} text={labels.contactsText} layout={layout}>
<Grid cols="1-2" class="gap-4">
<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 label={labels.email} htmlFor={tpl("{0}-email", id)}>
<Input type="email" name="email" autocomplete="email" id={tpl("{0}-email", id)} data-slot="field" />
</Field>
</Grid>
</CheckoutStep>
<CheckoutStep number="2" title={labels.address} text={labels.addressText} layout={layout}>
<Field label={labels.street} htmlFor={tpl("{0}-street", id)}>
<Input type="text" name="street" autocomplete="address-line1" id={tpl("{0}-street", id)} data-slot="field" />
</Field>
<Grid cols="2-4" class="gap-4">
<Field label={labels.house} htmlFor={tpl("{0}-house", id)}>
<Input type="text" name="house" id={tpl("{0}-house", id)} data-slot="field" />
</Field>
<Field label={labels.flat} htmlFor={tpl("{0}-flat", id)}>
<Input type="text" name="flat" id={tpl("{0}-flat", id)} data-slot="field" />
</Field>
<Field label={labels.entrance} htmlFor={tpl("{0}-entrance", id)}>
<Input type="text" name="entrance" id={tpl("{0}-entrance", id)} data-slot="field" />
</Field>
<Field label={labels.floor} htmlFor={tpl("{0}-floor", id)}>
<Input type="text" name="floor" id={tpl("{0}-floor", id)} data-slot="field" />
</Field>
</Grid>
<Field label={labels.comment} htmlFor={tpl("{0}-comment", id)}>
<Textarea rows={4} name="comment" id={tpl("{0}-comment", id)} data-slot="field" />
</Field>
</CheckoutStep>
<CheckoutStep number="3" title={labels.slot} text={labels.slotText} layout={layout}>
{#if ((days?.length ?? 0) > 0)}
<SlotGrid days={days} name={tpl("{0}-slot", id)} item="plain" />
{/if}
</CheckoutStep>
<CheckoutStep number="4" title={labels.payment} text={labels.paymentText} layout={layout}>
{#if ((payments?.length ?? 0) > 0)}
<PaymentOptions payments={payments} name={tpl("{0}-payment", id)} checked="payment-card" />
{/if}
</CheckoutStep>
<CheckoutSubmit id={id} consent={labels.consent} submit={labels.submit} legal={labels.legal} />
</Form>
{#if ((summary as string) === "aside")}
<Box class="lg:sticky lg:top-8" data-slot="aside">
<CartSummaryCard
field={tpl("{0}-promo", id)}
lines={lines}
rows={rows}
promos={promos}
labels={totals}
items="show"
/>
</Box>
{/if}
</Box>
</SectionFrame>
// 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 CheckoutLabels = {
contacts: string;
contactsText: string;
name: string;
phone: string;
email: string;
address: string;
addressText: string;
street: string;
house: string;
flat: string;
entrance: string;
floor: string;
comment: string;
slot: string;
slotText: string;
payment: string;
paymentText: string;
consent: string;
submit: string;
legal: string;
};
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 checkout-form// 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 checkout on one page: contacts, address, a delivery window, the payment and the consent as stacked steps,
* beside a sticky order summary with the lines, a promo code and the totals. Static markup. Axes: layout (cards:
* each step in a card, numbered: numbered steps divided by a line), summary (aside, none), tone.
*/
import { type ReactNode } from "react";
import { Box, Form, Grid, Input, Textarea } from "../compose";
import { CartSummaryCard } from "../components/cart-summary-card";
import { CheckoutStep } from "../components/checkout-step";
import { CheckoutSubmit } from "../components/checkout-submit";
import { Field } from "../components/field";
import { PaymentOptions } from "../components/payment-options";
import { SectionFrame } from "../components/section-frame";
import { SlotGrid } from "../components/slot-grid";
import { tpl } from "../utils";
import type { CheckoutLabels } from "./checkout-form.types";
import type { Day } from "../components/slot-grid.types";
import type { Payment } from "../components/payment-options.types";
import type { CartLine } from "./cart-list.types";
import type { SummaryRow } from "./order-summary.types";
import type { Promo, CartSummaryLabels } from "../components/cart-summary-card.types";
export type CheckoutFormProps = {
id: string;
title?: string;
days: Day[];
payments: Payment[];
lines: CartLine[];
rows: SummaryRow[];
promos: Promo[];
labels: CheckoutLabels;
totals: CartSummaryLabels;
layout?: "cards" | "numbered";
summary?: "aside" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function CheckoutForm({
id,
title = "",
days,
payments,
lines,
rows,
promos,
labels,
totals,
layout = "cards",
summary = "aside",
tone = "default",
landmarkLabel,
}: CheckoutFormProps) {
return (
<SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
<Box className="grid grid-cols-1 items-start gap-8 lg:grid-cols-3">
<Form
method="dialog"
className={
(summary as string) === "aside" ? "flex flex-col gap-6 lg:col-span-2"
: "flex flex-col gap-6 lg:col-span-3"
}
data-slot="checkout-form"
>
<CheckoutStep number="1" title={labels.contacts} text={labels.contactsText} layout={layout}>
<Grid cols="1-2" className="gap-4">
<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 label={labels.email} htmlFor={tpl("{0}-email", id)}>
<Input type="email" name="email" autoComplete="email" id={tpl("{0}-email", id)} data-slot="field" />
</Field>
</Grid>
</CheckoutStep>
<CheckoutStep number="2" title={labels.address} text={labels.addressText} layout={layout}>
<Field label={labels.street} htmlFor={tpl("{0}-street", id)}>
<Input type="text" name="street" autoComplete="address-line1" id={tpl("{0}-street", id)} data-slot="field" />
</Field>
<Grid cols="2-4" className="gap-4">
<Field label={labels.house} htmlFor={tpl("{0}-house", id)}>
<Input type="text" name="house" id={tpl("{0}-house", id)} data-slot="field" />
</Field>
<Field label={labels.flat} htmlFor={tpl("{0}-flat", id)}>
<Input type="text" name="flat" id={tpl("{0}-flat", id)} data-slot="field" />
</Field>
<Field label={labels.entrance} htmlFor={tpl("{0}-entrance", id)}>
<Input type="text" name="entrance" id={tpl("{0}-entrance", id)} data-slot="field" />
</Field>
<Field label={labels.floor} htmlFor={tpl("{0}-floor", id)}>
<Input type="text" name="floor" id={tpl("{0}-floor", id)} data-slot="field" />
</Field>
</Grid>
<Field label={labels.comment} htmlFor={tpl("{0}-comment", id)}>
<Textarea rows={4} name="comment" id={tpl("{0}-comment", id)} data-slot="field" />
</Field>
</CheckoutStep>
<CheckoutStep number="3" title={labels.slot} text={labels.slotText} layout={layout}>
{((days?.length ?? 0) > 0) ? (
<SlotGrid days={days} name={tpl("{0}-slot", id)} item="plain" />
) : null}
</CheckoutStep>
<CheckoutStep number="4" title={labels.payment} text={labels.paymentText} layout={layout}>
{((payments?.length ?? 0) > 0) ? (
<PaymentOptions payments={payments} name={tpl("{0}-payment", id)} checked="payment-card" />
) : null}
</CheckoutStep>
<CheckoutSubmit id={id} consent={labels.consent} submit={labels.submit} legal={labels.legal} />
</Form>
{((summary as string) === "aside") ? (
<Box className="lg:sticky lg:top-8" data-slot="aside">
<CartSummaryCard
field={tpl("{0}-promo", id)}
lines={lines}
rows={rows}
promos={promos}
labels={totals}
items="show"
/>
</Box>
) : null}
</Box>
</SectionFrame>
);
}
// 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 CheckoutLabels = {
contacts: string;
contactsText: string;
name: string;
phone: string;
email: string;
address: string;
addressText: string;
street: string;
house: string;
flat: string;
entrance: string;
floor: string;
comment: string;
slot: string;
slotText: string;
payment: string;
paymentText: string;
consent: string;
submit: string;
legal: string;
};
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 checkout-form// 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 CheckoutLabels = {
contacts: string;
contactsText: string;
name: string;
phone: string;
email: string;
address: string;
addressText: string;
street: string;
house: string;
flat: string;
entrance: string;
floor: string;
comment: string;
slot: string;
slotText: string;
payment: string;
paymentText: string;
consent: string;
submit: string;
legal: string;
};
<!-- 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 checkout on one page: contacts, address, a delivery window, the payment and the consent as stacked steps,
beside a sticky order summary with the lines, a promo code and the totals. Static markup. Axes: layout (cards:
each step in a card, numbered: numbered steps divided by a line), summary (aside, none), tone.
-->
<script lang="ts">
import type { CheckoutLabels } from "./checkout-form.types";
import type { Day } from "../components/slot-grid.types";
import type { Payment } from "../components/payment-options.types";
import type { CartLine } from "./cart-list.types";
import type { SummaryRow } from "./order-summary.types";
import type { Promo, CartSummaryLabels } from "../components/cart-summary-card.types";
export type CheckoutFormProps = {
id: string;
title?: string;
days: Day[];
payments: Payment[];
lines: CartLine[];
rows: SummaryRow[];
promos: Promo[];
labels: CheckoutLabels;
totals: CartSummaryLabels;
layout?: "cards" | "numbered";
summary?: "aside" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Form from "../compose/Form.vue";
import Grid from "../compose/Grid.vue";
import Input from "../compose/Input.vue";
import Textarea from "../compose/Textarea.vue";
import CartSummaryCard from "../components/cart-summary-card.vue";
import CheckoutStep from "../components/checkout-step.vue";
import CheckoutSubmit from "../components/checkout-submit.vue";
import Field from "../components/field.vue";
import PaymentOptions from "../components/payment-options.vue";
import SectionFrame from "../components/section-frame.vue";
import SlotGrid from "../components/slot-grid.vue";
import { tpl } from "../utils";
const {
id,
title = "",
days,
payments,
lines,
rows,
promos,
labels,
totals,
layout = "cards",
summary = "aside",
tone = "default",
landmarkLabel,
} = defineProps<CheckoutFormProps>();
</script>
<template>
<SectionFrame :id="id" :title="title" :tone="tone" :landmarkLabel="landmarkLabel">
<Box class="grid grid-cols-1 items-start gap-8 lg:grid-cols-3">
<Form
method="dialog"
:class="
(summary as string) === 'aside' ? 'flex flex-col gap-6 lg:col-span-2'
: 'flex flex-col gap-6 lg:col-span-3'
"
data-slot="checkout-form"
>
<CheckoutStep number="1" :title="labels.contacts" :text="labels.contactsText" :layout="layout">
<Grid cols="1-2" class="gap-4">
<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 :label="labels.email" :htmlFor="tpl('{0}-email', id)">
<Input type="email" name="email" autocomplete="email" :id="tpl('{0}-email', id)" data-slot="field" />
</Field>
</Grid>
</CheckoutStep>
<CheckoutStep number="2" :title="labels.address" :text="labels.addressText" :layout="layout">
<Field :label="labels.street" :htmlFor="tpl('{0}-street', id)">
<Input type="text" name="street" autocomplete="address-line1" :id="tpl('{0}-street', id)" data-slot="field" />
</Field>
<Grid cols="2-4" class="gap-4">
<Field :label="labels.house" :htmlFor="tpl('{0}-house', id)">
<Input type="text" name="house" :id="tpl('{0}-house', id)" data-slot="field" />
</Field>
<Field :label="labels.flat" :htmlFor="tpl('{0}-flat', id)">
<Input type="text" name="flat" :id="tpl('{0}-flat', id)" data-slot="field" />
</Field>
<Field :label="labels.entrance" :htmlFor="tpl('{0}-entrance', id)">
<Input type="text" name="entrance" :id="tpl('{0}-entrance', id)" data-slot="field" />
</Field>
<Field :label="labels.floor" :htmlFor="tpl('{0}-floor', id)">
<Input type="text" name="floor" :id="tpl('{0}-floor', id)" data-slot="field" />
</Field>
</Grid>
<Field :label="labels.comment" :htmlFor="tpl('{0}-comment', id)">
<Textarea :rows="4" name="comment" :id="tpl('{0}-comment', id)" data-slot="field" />
</Field>
</CheckoutStep>
<CheckoutStep number="3" :title="labels.slot" :text="labels.slotText" :layout="layout">
<SlotGrid v-if="((days?.length ?? 0) > 0)" :days="days" :name="tpl('{0}-slot', id)" item="plain" />
</CheckoutStep>
<CheckoutStep number="4" :title="labels.payment" :text="labels.paymentText" :layout="layout">
<PaymentOptions
v-if="((payments?.length ?? 0) > 0)"
:payments="payments"
:name="tpl('{0}-payment', id)"
checked="payment-card"
/>
</CheckoutStep>
<CheckoutSubmit :id="id" :consent="labels.consent" :submit="labels.submit" :legal="labels.legal" />
</Form>
<Box v-if="((summary as string) === 'aside')" class="lg:sticky lg:top-8" data-slot="aside">
<CartSummaryCard
:field="tpl('{0}-promo', id)"
:lines="lines"
:rows="rows"
:promos="promos"
:labels="totals"
items="show"
/>
</Box>
</Box>
</SectionFrame>
</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 checkout-form// 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 checkout on one page: contacts, address, a delivery window, the payment and the consent as stacked steps,
* beside a sticky order summary with the lines, a promo code and the totals. Static markup. Axes: layout (cards:
* each step in a card, numbered: numbered steps divided by a line), summary (aside, none), tone.
*/
import { For, type JSX } from "solid-js";
import { Box, Form, Grid, Input, Textarea } from "../compose";
import { CartSummaryCard } from "../components/cart-summary-card";
import { CheckoutStep } from "../components/checkout-step";
import { CheckoutSubmit } from "../components/checkout-submit";
import { Field } from "../components/field";
import { PaymentOptions } from "../components/payment-options";
import { SectionFrame } from "../components/section-frame";
import { SlotGrid } from "../components/slot-grid";
import { tpl } from "../utils";
import type { CheckoutLabels } from "./checkout-form.types";
import type { Day } from "../components/slot-grid.types";
import type { Payment } from "../components/payment-options.types";
import type { CartLine } from "./cart-list.types";
import type { SummaryRow } from "./order-summary.types";
import type { Promo, CartSummaryLabels } from "../components/cart-summary-card.types";
export type CheckoutFormProps = {
id: string;
title?: string;
days: Day[];
payments: Payment[];
lines: CartLine[];
rows: SummaryRow[];
promos: Promo[];
labels: CheckoutLabels;
totals: CartSummaryLabels;
layout?: "cards" | "numbered";
summary?: "aside" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function CheckoutForm({
id,
title = "",
days,
payments,
lines,
rows,
promos,
labels,
totals,
layout = "cards",
summary = "aside",
tone = "default",
landmarkLabel,
}: CheckoutFormProps) {
return (
<SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
<Box class="grid grid-cols-1 items-start gap-8 lg:grid-cols-3">
<Form
method="dialog"
class={
(summary as string) === "aside" ? "flex flex-col gap-6 lg:col-span-2"
: "flex flex-col gap-6 lg:col-span-3"
}
data-slot="checkout-form"
>
<CheckoutStep number="1" title={labels.contacts} text={labels.contactsText} layout={layout}>
<Grid cols="1-2" class="gap-4">
<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 label={labels.email} htmlFor={tpl("{0}-email", id)}>
<Input type="email" name="email" autocomplete="email" id={tpl("{0}-email", id)} data-slot="field" />
</Field>
</Grid>
</CheckoutStep>
<CheckoutStep number="2" title={labels.address} text={labels.addressText} layout={layout}>
<Field label={labels.street} htmlFor={tpl("{0}-street", id)}>
<Input type="text" name="street" autocomplete="address-line1" id={tpl("{0}-street", id)} data-slot="field" />
</Field>
<Grid cols="2-4" class="gap-4">
<Field label={labels.house} htmlFor={tpl("{0}-house", id)}>
<Input type="text" name="house" id={tpl("{0}-house", id)} data-slot="field" />
</Field>
<Field label={labels.flat} htmlFor={tpl("{0}-flat", id)}>
<Input type="text" name="flat" id={tpl("{0}-flat", id)} data-slot="field" />
</Field>
<Field label={labels.entrance} htmlFor={tpl("{0}-entrance", id)}>
<Input type="text" name="entrance" id={tpl("{0}-entrance", id)} data-slot="field" />
</Field>
<Field label={labels.floor} htmlFor={tpl("{0}-floor", id)}>
<Input type="text" name="floor" id={tpl("{0}-floor", id)} data-slot="field" />
</Field>
</Grid>
<Field label={labels.comment} htmlFor={tpl("{0}-comment", id)}>
<Textarea rows={4} name="comment" id={tpl("{0}-comment", id)} data-slot="field" />
</Field>
</CheckoutStep>
<CheckoutStep number="3" title={labels.slot} text={labels.slotText} layout={layout}>
{((days?.length ?? 0) > 0) ? (
<SlotGrid days={days} name={tpl("{0}-slot", id)} item="plain" />
) : null}
</CheckoutStep>
<CheckoutStep number="4" title={labels.payment} text={labels.paymentText} layout={layout}>
{((payments?.length ?? 0) > 0) ? (
<PaymentOptions payments={payments} name={tpl("{0}-payment", id)} checked="payment-card" />
) : null}
</CheckoutStep>
<CheckoutSubmit id={id} consent={labels.consent} submit={labels.submit} legal={labels.legal} />
</Form>
{((summary as string) === "aside") ? (
<Box class="lg:sticky lg:top-8" data-slot="aside">
<CartSummaryCard
field={tpl("{0}-promo", id)}
lines={lines}
rows={rows}
promos={promos}
labels={totals}
items="show"
/>
</Box>
) : null}
</Box>
</SectionFrame>
);
}
// 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 CheckoutLabels = {
contacts: string;
contactsText: string;
name: string;
phone: string;
email: string;
address: string;
addressText: string;
street: string;
house: string;
flat: string;
entrance: string;
floor: string;
comment: string;
slot: string;
slotText: string;
payment: string;
paymentText: string;
consent: string;
submit: string;
legal: string;
};
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 checkout-form// 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/checkout-form.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/form"
"github.com/ui8kit/codegen/generated/templ/ui/input"
"github.com/ui8kit/codegen/generated/templ/ui/textarea"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// CheckoutFormProps are the props of CheckoutForm; the values are the JSON shapes of the TypeScript props.
type CheckoutFormProps struct {
Id any `json:"id"`
Title any `json:"title"`
Days any `json:"days"`
Payments any `json:"payments"`
Lines any `json:"lines"`
Rows any `json:"rows"`
Promos any `json:"promos"`
Labels any `json:"labels"`
Totals any `json:"totals"`
Layout any `json:"layout"`
Summary any `json:"summary"`
Tone any `json:"tone"`
LandmarkLabel any `json:"landmarkLabel"`
}
// A checkout on one page: contacts, address, a delivery window, the payment and the consent as stacked steps, beside a sticky order summary with the lines, a promo code and the totals. Static markup. Axes: layout (cards: each step in a card, numbered: numbered steps divided by a line), summary (aside, none), tone.
templ CheckoutForm(p CheckoutFormProps) {
{{ vId := p.Id }}
{{ vTitle := uiutils.Def(p.Title, "") }}
{{ vDays := p.Days }}
{{ vPayments := p.Payments }}
{{ vLines := p.Lines }}
{{ vRows := p.Rows }}
{{ vPromos := p.Promos }}
{{ vLabels := p.Labels }}
{{ vTotals := p.Totals }}
{{ vLayout := uiutils.Def(p.Layout, "cards") }}
{{ vSummary := uiutils.Def(p.Summary, "aside") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, LandmarkLabel: vLandmarkLabel}) {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "grid grid-cols-1 items-start gap-8 lg:grid-cols-3"}}) {
@compose.Form(compose.FormProps{FormProps: form.FormProps{Method: "dialog", Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vSummary, "aside")), "flex flex-col gap-6 lg:col-span-2", "flex flex-col gap-6 lg:col-span-3")), Attrs: uiutils.Attrs("data-slot", "checkout-form")}}) {
@CheckoutStep(CheckoutStepProps{Number: "1", Title: uiutils.Get(vLabels, "contacts"), Text: uiutils.Get(vLabels, "contactsText"), Layout: vLayout}) {
@compose.Grid(compose.GridProps{Cols: "1-2", BoxProps: box.BoxProps{Class: "gap-4"}}) {
@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")}})
}
@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")}})
}
}
}
@CheckoutStep(CheckoutStepProps{Number: "2", Title: uiutils.Get(vLabels, "address"), Text: uiutils.Get(vLabels, "addressText"), Layout: vLayout}) {
@Field(FieldProps{Label: uiutils.Get(vLabels, "street"), HtmlFor: uiutils.Tpl("{0}-street", vId)}) {
@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: "street", Attrs: uiutils.Attrs("autocomplete", "address-line1", "id", uiutils.Tpl("{0}-street", vId), "data-slot", "field")}})
}
@compose.Grid(compose.GridProps{Cols: "2-4", BoxProps: box.BoxProps{Class: "gap-4"}}) {
@Field(FieldProps{Label: uiutils.Get(vLabels, "house"), HtmlFor: uiutils.Tpl("{0}-house", vId)}) {
@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: "house", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-house", vId), "data-slot", "field")}})
}
@Field(FieldProps{Label: uiutils.Get(vLabels, "flat"), HtmlFor: uiutils.Tpl("{0}-flat", vId)}) {
@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: "flat", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-flat", vId), "data-slot", "field")}})
}
@Field(FieldProps{Label: uiutils.Get(vLabels, "entrance"), HtmlFor: uiutils.Tpl("{0}-entrance", vId)}) {
@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: "entrance", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-entrance", vId), "data-slot", "field")}})
}
@Field(FieldProps{Label: uiutils.Get(vLabels, "floor"), HtmlFor: uiutils.Tpl("{0}-floor", vId)}) {
@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: "floor", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-floor", vId), "data-slot", "field")}})
}
}
@Field(FieldProps{Label: uiutils.Get(vLabels, "comment"), HtmlFor: uiutils.Tpl("{0}-comment", vId)}) {
@compose.Textarea(compose.TextareaProps{TextareaProps: textarea.TextareaProps{Rows: "4", Name: "comment", Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-comment", vId), "data-slot", "field")}})
}
}
@CheckoutStep(CheckoutStepProps{Number: "3", Title: uiutils.Get(vLabels, "slot"), Text: uiutils.Get(vLabels, "slotText"), Layout: vLayout}) {
if uiutils.Gt(uiutils.Len(vDays), float64(0)) {
@SlotGrid(SlotGridProps{Days: vDays, Name: uiutils.Tpl("{0}-slot", vId), Item: "plain"})
}
}
@CheckoutStep(CheckoutStepProps{Number: "4", Title: uiutils.Get(vLabels, "payment"), Text: uiutils.Get(vLabels, "paymentText"), Layout: vLayout}) {
if uiutils.Gt(uiutils.Len(vPayments), float64(0)) {
@PaymentOptions(PaymentOptionsProps{Payments: vPayments, Name: uiutils.Tpl("{0}-payment", vId), Checked: "payment-card"})
}
}
@CheckoutSubmit(CheckoutSubmitProps{Id: vId, Consent: uiutils.Get(vLabels, "consent"), Submit: uiutils.Get(vLabels, "submit"), Legal: uiutils.Get(vLabels, "legal")})
}
if uiutils.Eq(vSummary, "aside") {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "lg:sticky lg:top-8", Attrs: uiutils.Attrs("data-slot", "aside")}}) {
@CartSummaryCard(CartSummaryCardProps{Field: uiutils.Tpl("{0}-promo", vId), Lines: vLines, Rows: vRows, Promos: vPromos, Labels: vTotals, Items: "show"})
}
}
}
}
}
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 checkout-form{#- 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/checkout-form.json
A checkout on one page: contacts, address, a delivery window, the payment and the consent as stacked steps, beside a sticky order summary with the lines, a promo code and the totals. Static markup. Axes: layout (cards: each step in a card, numbered: numbered steps divided by a line), summary (aside, none), tone.
Props (p): id, title, days, payments, lines, rows, promos, labels, totals, layout, summary, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? '') -%}
{%- set v_days = (p.days ?? null) -%}
{%- set v_payments = (p.payments ?? null) -%}
{%- set v_lines = (p.lines ?? null) -%}
{%- set v_rows = (p.rows ?? null) -%}
{%- set v_promos = (p.promos ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_totals = (p.totals ?? null) -%}
{%- set v_layout = (p.layout ?? 'cards') -%}
{%- set v_summary = (p.summary ?? 'aside') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_19 -%}
{%- set c_18 -%}
{%- set c_16 -%}
{%- set c_5 -%}
{%- set c_4 -%}
{%- 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) }}
{%- 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) }}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': '1-2', 'class': 'gap-4', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('blocks/checkout-step.html.twig', {'p': {'number': '1', 'title': og_get(v_labels, ['contacts']), 'text': og_get(v_labels, ['contactsText']), 'layout': v_layout}, 'children': og_markup(c_5)}, with_context = false) }}
{%- set c_13 -%}
{%- set c_6 -%}
{{ include('compose/Input.html.twig', {'type': 'text', 'name': 'street', 'attrs': og_attrs(['autocomplete', 'address-line1', 'id', og_tpl('{0}-street', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['street']), 'htmlFor': og_tpl('{0}-street', [v_id])}, 'children': og_markup(c_6)}, with_context = false) }}
{%- set c_11 -%}
{%- set c_7 -%}
{{ include('compose/Input.html.twig', {'type': 'text', 'name': 'house', 'attrs': og_attrs(['id', og_tpl('{0}-house', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['house']), 'htmlFor': og_tpl('{0}-house', [v_id])}, 'children': og_markup(c_7)}, with_context = false) }}
{%- set c_8 -%}
{{ include('compose/Input.html.twig', {'type': 'text', 'name': 'flat', 'attrs': og_attrs(['id', og_tpl('{0}-flat', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['flat']), 'htmlFor': og_tpl('{0}-flat', [v_id])}, 'children': og_markup(c_8)}, with_context = false) }}
{%- set c_9 -%}
{{ include('compose/Input.html.twig', {'type': 'text', 'name': 'entrance', 'attrs': og_attrs(['id', og_tpl('{0}-entrance', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['entrance']), 'htmlFor': og_tpl('{0}-entrance', [v_id])}, 'children': og_markup(c_9)}, with_context = false) }}
{%- set c_10 -%}
{{ include('compose/Input.html.twig', {'type': 'text', 'name': 'floor', 'attrs': og_attrs(['id', og_tpl('{0}-floor', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['floor']), 'htmlFor': og_tpl('{0}-floor', [v_id])}, 'children': og_markup(c_10)}, with_context = false) }}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': '2-4', 'class': 'gap-4', 'children': c_11}, with_context = false) }}
{%- set c_12 -%}
{{ include('compose/Textarea.html.twig', {'rows': 4, 'name': 'comment', 'attrs': og_attrs(['id', og_tpl('{0}-comment', [v_id]), 'data-slot', 'field'])}, with_context = false) }}
{%- endset -%}
{{ include('blocks/field.html.twig', {'p': {'label': og_get(v_labels, ['comment']), 'htmlFor': og_tpl('{0}-comment', [v_id])}, 'children': og_markup(c_12)}, with_context = false) }}
{%- endset -%}
{{ include('blocks/checkout-step.html.twig', {'p': {'number': '2', 'title': og_get(v_labels, ['address']), 'text': og_get(v_labels, ['addressText']), 'layout': v_layout}, 'children': og_markup(c_13)}, with_context = false) }}
{%- set c_14 -%}
{%- if og_t(og_gt(og_len(v_days), 0)) %}
{{ include('blocks/slot-grid.html.twig', {'p': {'days': v_days, 'name': og_tpl('{0}-slot', [v_id]), 'item': 'plain'}}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/checkout-step.html.twig', {'p': {'number': '3', 'title': og_get(v_labels, ['slot']), 'text': og_get(v_labels, ['slotText']), 'layout': v_layout}, 'children': og_markup(c_14)}, with_context = false) }}
{%- set c_15 -%}
{%- if og_t(og_gt(og_len(v_payments), 0)) %}
{{ include('blocks/payment-options.html.twig', {'p': {'payments': v_payments, 'name': og_tpl('{0}-payment', [v_id]), 'checked': 'payment-card'}}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/checkout-step.html.twig', {'p': {'number': '4', 'title': og_get(v_labels, ['payment']), 'text': og_get(v_labels, ['paymentText']), 'layout': v_layout}, 'children': og_markup(c_15)}, with_context = false) }}
{{ include('blocks/checkout-submit.html.twig', {'p': {'id': v_id, 'consent': og_get(v_labels, ['consent']), 'submit': og_get(v_labels, ['submit']), 'legal': og_get(v_labels, ['legal'])}}, with_context = false) }}
{%- endset -%}
{{ include('compose/Form.html.twig', {'method': 'dialog', 'class': og_s((og_t(og_eq(v_summary, 'aside')) ? 'flex flex-col gap-6 lg:col-span-2' : 'flex flex-col gap-6 lg:col-span-3')), 'attrs': og_attrs(['data-slot', 'checkout-form']), 'children': c_16}, with_context = false) }}
{%- if og_t(og_eq(v_summary, 'aside')) %}
{%- set c_17 -%}
{{ include('blocks/cart-summary-card.html.twig', {'p': {'field': og_tpl('{0}-promo', [v_id]), 'lines': v_lines, 'rows': v_rows, 'promos': v_promos, 'labels': v_totals, 'items': 'show'}}, with_context = false) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'lg:sticky lg:top-8', 'attrs': og_attrs(['data-slot', 'aside']), 'children': c_17}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'grid grid-cols-1 items-start gap-8 lg:grid-cols-3', 'children': c_18}, with_context = false) }}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_19)}, 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 checkout-form{* 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/checkout-form.json
A checkout on one page: contacts, address, a delivery window, the payment and the consent as stacked steps, beside a sticky order summary with the lines, a promo code and the totals. Static markup. Axes: layout (cards: each step in a card, numbered: numbered steps divided by a line), summary (aside, none), tone.
Props (p): id, title, days, payments, lines, rows, promos, labels, totals, layout, summary, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? '')}
{var $v_days = ($p['days'] ?? null)}
{var $v_payments = ($p['payments'] ?? null)}
{var $v_lines = ($p['lines'] ?? null)}
{var $v_rows = ($p['rows'] ?? null)}
{var $v_promos = ($p['promos'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_totals = ($p['totals'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'cards')}
{var $v_summary = ($p['summary'] ?? 'aside')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_19}
{capture $c_18}
{capture $c_16}
{capture $c_5}
{capture $c_4}
{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}
{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}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => '1-2', 'class' => 'gap-4', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('blocks/checkout-step.latte', ['p' => ['number' => '1', 'title' => og_get($v_labels, ['contacts']), 'text' => og_get($v_labels, ['contactsText']), 'layout' => $v_layout], 'children' => og_markup($c_5)])|noescape}
{capture $c_13}
{capture $c_6}
{=og_include('compose/Input.latte', ['type' => 'text', 'name' => 'street', 'attrs' => og_attrs(['autocomplete', 'address-line1', 'id', og_tpl('{0}-street', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['street']), 'htmlFor' => og_tpl('{0}-street', [$v_id])], 'children' => og_markup($c_6)])|noescape}
{capture $c_11}
{capture $c_7}
{=og_include('compose/Input.latte', ['type' => 'text', 'name' => 'house', 'attrs' => og_attrs(['id', og_tpl('{0}-house', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['house']), 'htmlFor' => og_tpl('{0}-house', [$v_id])], 'children' => og_markup($c_7)])|noescape}
{capture $c_8}
{=og_include('compose/Input.latte', ['type' => 'text', 'name' => 'flat', 'attrs' => og_attrs(['id', og_tpl('{0}-flat', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['flat']), 'htmlFor' => og_tpl('{0}-flat', [$v_id])], 'children' => og_markup($c_8)])|noescape}
{capture $c_9}
{=og_include('compose/Input.latte', ['type' => 'text', 'name' => 'entrance', 'attrs' => og_attrs(['id', og_tpl('{0}-entrance', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['entrance']), 'htmlFor' => og_tpl('{0}-entrance', [$v_id])], 'children' => og_markup($c_9)])|noescape}
{capture $c_10}
{=og_include('compose/Input.latte', ['type' => 'text', 'name' => 'floor', 'attrs' => og_attrs(['id', og_tpl('{0}-floor', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['floor']), 'htmlFor' => og_tpl('{0}-floor', [$v_id])], 'children' => og_markup($c_10)])|noescape}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => '2-4', 'class' => 'gap-4', 'children' => (string) $c_11])|noescape}
{capture $c_12}
{=og_include('compose/Textarea.latte', ['rows' => 4, 'name' => 'comment', 'attrs' => og_attrs(['id', og_tpl('{0}-comment', [$v_id]), 'data-slot', 'field'])])|noescape}
{/capture}
{=og_include('blocks/field.latte', ['p' => ['label' => og_get($v_labels, ['comment']), 'htmlFor' => og_tpl('{0}-comment', [$v_id])], 'children' => og_markup($c_12)])|noescape}
{/capture}
{=og_include('blocks/checkout-step.latte', ['p' => ['number' => '2', 'title' => og_get($v_labels, ['address']), 'text' => og_get($v_labels, ['addressText']), 'layout' => $v_layout], 'children' => og_markup($c_13)])|noescape}
{capture $c_14}
{if og_t(og_gt(og_len($v_days), 0))}
{=og_include('blocks/slot-grid.latte', ['p' => ['days' => $v_days, 'name' => og_tpl('{0}-slot', [$v_id]), 'item' => 'plain']])|noescape}
{/if}
{/capture}
{=og_include('blocks/checkout-step.latte', ['p' => ['number' => '3', 'title' => og_get($v_labels, ['slot']), 'text' => og_get($v_labels, ['slotText']), 'layout' => $v_layout], 'children' => og_markup($c_14)])|noescape}
{capture $c_15}
{if og_t(og_gt(og_len($v_payments), 0))}
{=og_include('blocks/payment-options.latte', ['p' => ['payments' => $v_payments, 'name' => og_tpl('{0}-payment', [$v_id]), 'checked' => 'payment-card']])|noescape}
{/if}
{/capture}
{=og_include('blocks/checkout-step.latte', ['p' => ['number' => '4', 'title' => og_get($v_labels, ['payment']), 'text' => og_get($v_labels, ['paymentText']), 'layout' => $v_layout], 'children' => og_markup($c_15)])|noescape}
{=og_include('blocks/checkout-submit.latte', ['p' => ['id' => $v_id, 'consent' => og_get($v_labels, ['consent']), 'submit' => og_get($v_labels, ['submit']), 'legal' => og_get($v_labels, ['legal'])]])|noescape}
{/capture}
{=og_include('compose/Form.latte', ['method' => 'dialog', 'class' => og_s((og_t(og_eq($v_summary, 'aside')) ? 'flex flex-col gap-6 lg:col-span-2' : 'flex flex-col gap-6 lg:col-span-3')), 'attrs' => og_attrs(['data-slot', 'checkout-form']), 'children' => (string) $c_16])|noescape}
{if og_t(og_eq($v_summary, 'aside'))}
{capture $c_17}
{=og_include('blocks/cart-summary-card.latte', ['p' => ['field' => og_tpl('{0}-promo', [$v_id]), 'lines' => $v_lines, 'rows' => $v_rows, 'promos' => $v_promos, 'labels' => $v_totals, 'items' => 'show']])|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'lg:sticky lg:top-8', 'attrs' => og_attrs(['data-slot', 'aside']), 'children' => (string) $c_17])|noescape}
{/if}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'grid grid-cols-1 items-start gap-8 lg:grid-cols-3', 'children' => (string) $c_18])|noescape}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_19)])|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 checkout-form{#- 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/checkout-form.json
A checkout on one page: contacts, address, a delivery window, the payment and the consent as stacked steps, beside a sticky order summary with the lines, a promo code and the totals. Static markup. Axes: layout (cards: each step in a card, numbered: numbered steps divided by a line), summary (aside, none), tone.
Props (p): id, title, days, payments, lines, rows, promos, labels, totals, layout, summary, tone, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], '') -%}
{%- set v_days = og_def(p['days'], none) -%}
{%- set v_payments = og_def(p['payments'], none) -%}
{%- set v_lines = og_def(p['lines'], none) -%}
{%- set v_rows = og_def(p['rows'], none) -%}
{%- set v_promos = og_def(p['promos'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_totals = og_def(p['totals'], none) -%}
{%- set v_layout = og_def(p['layout'], 'cards') -%}
{%- set v_summary = og_def(p['summary'], 'aside') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_19 -%}
{%- set c_18 -%}
{%- set c_16 -%}
{%- set c_5 -%}
{%- set c_4 -%}
{%- 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)}) }}
{%- 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)}) }}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': '1-2', 'Class': 'gap-4'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('blocks/checkout-step.html.j2', {'p': {'number': '1', 'title': og_get(v_labels, ['contacts']), 'text': og_get(v_labels, ['contactsText']), 'layout': v_layout}, 'children': og_markup(c_5)}) }}
{%- set c_13 -%}
{%- set c_6 -%}
{{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': 'street', 'Attrs': og_attrs(['autocomplete', 'address-line1', 'id', og_tpl('{0}-street', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['street']), 'htmlFor': og_tpl('{0}-street', [v_id])}, 'children': og_markup(c_6)}) }}
{%- set c_11 -%}
{%- set c_7 -%}
{{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': 'house', 'Attrs': og_attrs(['id', og_tpl('{0}-house', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['house']), 'htmlFor': og_tpl('{0}-house', [v_id])}, 'children': og_markup(c_7)}) }}
{%- set c_8 -%}
{{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': 'flat', 'Attrs': og_attrs(['id', og_tpl('{0}-flat', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['flat']), 'htmlFor': og_tpl('{0}-flat', [v_id])}, 'children': og_markup(c_8)}) }}
{%- set c_9 -%}
{{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': 'entrance', 'Attrs': og_attrs(['id', og_tpl('{0}-entrance', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['entrance']), 'htmlFor': og_tpl('{0}-entrance', [v_id])}, 'children': og_markup(c_9)}) }}
{%- set c_10 -%}
{{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': 'floor', 'Attrs': og_attrs(['id', og_tpl('{0}-floor', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['floor']), 'htmlFor': og_tpl('{0}-floor', [v_id])}, 'children': og_markup(c_10)}) }}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': '2-4', 'Class': 'gap-4'}, 'children': c_11}) }}
{%- set c_12 -%}
{{ og_include('compose/textarea.html.j2', {'p': {'Rows': 4, 'Name': 'comment', 'Attrs': og_attrs(['id', og_tpl('{0}-comment', [v_id]), 'data-slot', 'field'])}}) }}
{%- endset -%}
{{ og_include('blocks/field.html.j2', {'p': {'label': og_get(v_labels, ['comment']), 'htmlFor': og_tpl('{0}-comment', [v_id])}, 'children': og_markup(c_12)}) }}
{%- endset -%}
{{ og_include('blocks/checkout-step.html.j2', {'p': {'number': '2', 'title': og_get(v_labels, ['address']), 'text': og_get(v_labels, ['addressText']), 'layout': v_layout}, 'children': og_markup(c_13)}) }}
{%- set c_14 -%}
{%- if og_t(og_gt(og_len(v_days), 0)) %}
{{ og_include('blocks/slot-grid.html.j2', {'p': {'days': v_days, 'name': og_tpl('{0}-slot', [v_id]), 'item': 'plain'}}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/checkout-step.html.j2', {'p': {'number': '3', 'title': og_get(v_labels, ['slot']), 'text': og_get(v_labels, ['slotText']), 'layout': v_layout}, 'children': og_markup(c_14)}) }}
{%- set c_15 -%}
{%- if og_t(og_gt(og_len(v_payments), 0)) %}
{{ og_include('blocks/payment-options.html.j2', {'p': {'payments': v_payments, 'name': og_tpl('{0}-payment', [v_id]), 'checked': 'payment-card'}}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/checkout-step.html.j2', {'p': {'number': '4', 'title': og_get(v_labels, ['payment']), 'text': og_get(v_labels, ['paymentText']), 'layout': v_layout}, 'children': og_markup(c_15)}) }}
{{ og_include('blocks/checkout-submit.html.j2', {'p': {'id': v_id, 'consent': og_get(v_labels, ['consent']), 'submit': og_get(v_labels, ['submit']), 'legal': og_get(v_labels, ['legal'])}}) }}
{%- endset -%}
{{ og_include('compose/form.html.j2', {'p': {'Method': 'dialog', 'Class': og_s(('flex flex-col gap-6 lg:col-span-2' if og_t(og_eq(v_summary, 'aside')) else 'flex flex-col gap-6 lg:col-span-3')), 'Attrs': og_attrs(['data-slot', 'checkout-form'])}, 'children': c_16}) }}
{%- if og_t(og_eq(v_summary, 'aside')) %}
{%- set c_17 -%}
{{ og_include('blocks/cart-summary-card.html.j2', {'p': {'field': og_tpl('{0}-promo', [v_id]), 'lines': v_lines, 'rows': v_rows, 'promos': v_promos, 'labels': v_totals, 'items': 'show'}}) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'lg:sticky lg:top-8', 'Attrs': og_attrs(['data-slot', 'aside'])}, 'children': c_17}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'grid grid-cols-1 items-start gap-8 lg:grid-cols-3'}, 'children': c_18}) }}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_19)}) }}
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 checkout on one page: contacts, address, a delivery window, the payment and the consent as stacked steps, beside a sticky order summary with the lines, a promo code and the totals. Static markup. Axes: layout (cards: each step in a card, numbered: numbered steps divided by a line), summary (aside, none), tone.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title | string | "" | section heading; empty: no heading (the page heading names the checkout) |
| days (required) | Day[] | - | |
| payments (required) | Payment[] | - | |
| lines (required) | CartLine[] | - | |
| rows (required) | SummaryRow[] | - | |
| promos (required) | Promo[] | - | |
| labels (required) | CheckoutLabels | - | |
| totals (required) | CartSummaryLabels | - | labels of the order summary |
| layout | "cards" | "numbered" | "cards" | |
| summary | "aside" | "none" | "aside" | |
| tone | "default" | "muted" | "default" | |
| landmarkLabel | string | - | accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one |