Checkout Step
Checkout Step component
Install
npx ui8kit add checkout-stepPulls in: box, compose, group, kit-box, kit-text, stack, text, title, utils
Preview
Payment
You pay after we confirm the order.
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-step<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
One step of a long form: an optional number, a heading (h2) and a line of text over the fields (`children`).
Axes: layout (cards: the step in a card, numbered: a number beside the heading and a line between steps).
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
export type CheckoutStepProps = {
number: string;
title: string;
text?: string;
layout?: "cards" | "numbered";
children?: Snippet;
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Group from "../compose/Group.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import Title from "../compose/Title.svelte";
let { number, title, text = "", layout = "cards", children }: CheckoutStepProps = $props();
</script>
<Stack
gap="6"
align="stretch"
class={
(layout as string) === "cards" ? "rounded bg-card inset-ring inset-ring-border p-6"
: "border-t border-border pt-6"
}
data-slot="step"
>
<Group gap="4" align="start">
{#if ((layout as string) === "numbered")}
<Box class={"flex size-8 shrink-0 items-center justify-center rounded bg-primary text-sm font-medium text-primary-foreground"}>
{number}
</Box>
{/if}
<Stack gap="0">
<Title as={2} size="lg" weight="semibold">
{title}
</Title>
{#if text}
<Text size="sm" class="text-muted-foreground">
{text}
</Text>
{/if}
</Stack>
</Group>
{@render children?.()}
</Stack>
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-step// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* One step of a long form: an optional number, a heading (h2) and a line of text over the fields (`children`).
* Axes: layout (cards: the step in a card, numbered: a number beside the heading and a line between steps).
*/
import { type ReactNode } from "react";
import { Box, Group, Stack, Text, Title } from "../compose";
export type CheckoutStepProps = {
number: string;
title: string;
text?: string;
layout?: "cards" | "numbered";
children?: ReactNode;
};
export function CheckoutStep({ number, title, text = "", layout = "cards", children }: CheckoutStepProps) {
return (
<Stack
gap="6"
align="stretch"
className={
(layout as string) === "cards" ? "rounded bg-card inset-ring inset-ring-border p-6"
: "border-t border-border pt-6"
}
data-slot="step"
>
<Group gap="4" align="start">
{((layout as string) === "numbered") ? (
<Box className={"flex size-8 shrink-0 items-center justify-center rounded bg-primary text-sm font-medium text-primary-foreground"}>
{number}
</Box>
) : null}
<Stack gap="0">
<Title as={2} size="lg" weight="semibold">
{title}
</Title>
{text ? (
<Text size="sm" className="text-muted-foreground">
{text}
</Text>
) : null}
</Stack>
</Group>
{children}
</Stack>
);
}
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-step<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
One step of a long form: an optional number, a heading (h2) and a line of text over the fields (`children`).
Axes: layout (cards: the step in a card, numbered: a number beside the heading and a line between steps).
-->
<script lang="ts">
export type CheckoutStepProps = {
number: string;
title: string;
text?: string;
layout?: "cards" | "numbered";
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Group from "../compose/Group.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
const { number, title, text = "", layout = "cards" } = defineProps<CheckoutStepProps>();
defineSlots<{ default?(): unknown }>();
</script>
<template>
<Stack
gap="6"
align="stretch"
:class="
(layout as string) === 'cards' ? 'rounded bg-card inset-ring inset-ring-border p-6'
: 'border-t border-border pt-6'
"
data-slot="step"
>
<Group gap="4" align="start">
<Box
v-if="((layout as string) === 'numbered')"
:class="'flex size-8 shrink-0 items-center justify-center rounded bg-primary text-sm font-medium text-primary-foreground'"
>
{{ number }}
</Box>
<Stack gap="0">
<Title :as="2" size="lg" weight="semibold">
{{ title }}
</Title>
<Text v-if="text" size="sm" class="text-muted-foreground">
{{ text }}
</Text>
</Stack>
</Group>
<slot />
</Stack>
</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-step// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* One step of a long form: an optional number, a heading (h2) and a line of text over the fields (`children`).
* Axes: layout (cards: the step in a card, numbered: a number beside the heading and a line between steps).
*/
import { type JSX } from "solid-js";
import { Box, Group, Stack, Text, Title } from "../compose";
export type CheckoutStepProps = {
number: string;
title: string;
text?: string;
layout?: "cards" | "numbered";
children?: JSX.Element;
};
export function CheckoutStep({ number, title, text = "", layout = "cards", children }: CheckoutStepProps) {
return (
<Stack
gap="6"
align="stretch"
class={
(layout as string) === "cards" ? "rounded bg-card inset-ring inset-ring-border p-6"
: "border-t border-border pt-6"
}
data-slot="step"
>
<Group gap="4" align="start">
{((layout as string) === "numbered") ? (
<Box class={"flex size-8 shrink-0 items-center justify-center rounded bg-primary text-sm font-medium text-primary-foreground"}>
{number}
</Box>
) : null}
<Stack gap="0">
<Title as={2} size="lg" weight="semibold">
{title}
</Title>
{text ? (
<Text size="sm" class="text-muted-foreground">
{text}
</Text>
) : null}
</Stack>
</Group>
{children}
</Stack>
);
}
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-step// 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-step.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// CheckoutStepProps are the props of CheckoutStep; the values are the JSON shapes of the TypeScript props.
type CheckoutStepProps struct {
Number any `json:"number"`
Title any `json:"title"`
Text any `json:"text"`
Layout any `json:"layout"`
}
// One step of a long form: an optional number, a heading (h2) and a line of text over the fields (`children`). Axes: layout (cards: the step in a card, numbered: a number beside the heading and a line between steps).
templ CheckoutStep(p CheckoutStepProps) {
{{ vNumber := p.Number }}
{{ vTitle := p.Title }}
{{ vText := uiutils.Def(p.Text, "") }}
{{ vLayout := uiutils.Def(p.Layout, "cards") }}
@compose.Stack(compose.StackProps{Gap: "6", Align: "stretch", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "cards")), "rounded bg-card inset-ring inset-ring-border p-6", "border-t border-border pt-6")), Attrs: uiutils.Attrs("data-slot", "step")}}) {
@compose.Group(compose.GroupProps{Gap: "4", Align: "start", BoxProps: box.BoxProps{}}) {
if uiutils.Eq(vLayout, "numbered") {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "flex size-8 shrink-0 items-center justify-center rounded bg-primary text-sm font-medium text-primary-foreground"}}) {
{ uiutils.Text(vNumber) }
}
}
@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{}}) {
@compose.Title(compose.TitleProps{As: "2", Size: "lg", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(vTitle) }
}
if uiutils.T(vText) {
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(vText) }
}
}
}
}
{ children... }
}
}
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-step{#- 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-step.json
One step of a long form: an optional number, a heading (h2) and a line of text over the fields (`children`). Axes: layout (cards: the step in a card, numbered: a number beside the heading and a line between steps).
Props (p): number, title, text, layout; children: markup. -#}
{%- set v_number = (p.number ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? '') -%}
{%- set v_layout = (p.layout ?? 'cards') -%}
{%- set c_6 -%}
{%- set c_5 -%}
{%- if og_t(og_eq(v_layout, 'numbered')) %}
{%- set c_1 -%}
{{ og_text(v_number) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'flex size-8 shrink-0 items-center justify-center rounded bg-primary text-sm font-medium text-primary-foreground', 'children': c_1}, with_context = false) }}
{%- endif %}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_text(v_title) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 2, 'size': 'lg', 'weight': 'semibold', 'children': c_2}, with_context = false) }}
{%- if og_t(v_text) %}
{%- set c_3 -%}
{{ og_text(v_text) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '0', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'start', 'children': c_5}, with_context = false) }}
{{ og_slot((children ?? null))|raw }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '6', 'align': 'stretch', 'class': og_s((og_t(og_eq(v_layout, 'cards')) ? 'rounded bg-card inset-ring inset-ring-border p-6' : 'border-t border-border pt-6')), 'attrs': og_attrs(['data-slot', 'step']), 'children': c_6}, with_context = false) }}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdnnpx ui8kit add checkout-step{* 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-step.json
One step of a long form: an optional number, a heading (h2) and a line of text over the fields (`children`). Axes: layout (cards: the step in a card, numbered: a number beside the heading and a line between steps).
Props (p): number, title, text, layout; children: markup. *}
{var $v_number = ($p['number'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? '')}
{var $v_layout = ($p['layout'] ?? 'cards')}
{capture $c_6}
{capture $c_5}
{if og_t(og_eq($v_layout, 'numbered'))}
{capture $c_1}
{=og_text($v_number)}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'flex size-8 shrink-0 items-center justify-center rounded bg-primary text-sm font-medium text-primary-foreground', 'children' => (string) $c_1])|noescape}
{/if}
{capture $c_4}
{capture $c_2}
{=og_text($v_title)}
{/capture}
{=og_include('compose/Title.latte', ['as' => 2, 'size' => 'lg', 'weight' => 'semibold', 'children' => (string) $c_2])|noescape}
{if og_t($v_text)}
{capture $c_3}
{=og_text($v_text)}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
{/if}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '0', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'start', 'children' => (string) $c_5])|noescape}
{=og_slot(($children ?? null))|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '6', 'align' => 'stretch', 'class' => og_s((og_t(og_eq($v_layout, 'cards')) ? 'rounded bg-card inset-ring inset-ring-border p-6' : 'border-t border-border pt-6')), 'attrs' => og_attrs(['data-slot', 'step']), 'children' => (string) $c_6])|noescape}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdnnpx ui8kit add checkout-step{#- 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-step.json
One step of a long form: an optional number, a heading (h2) and a line of text over the fields (`children`). Axes: layout (cards: the step in a card, numbered: a number beside the heading and a line between steps).
Props (p): number, title, text, layout; children: markup. -#}
{%- set v_number = og_def(p['number'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_text = og_def(p['text'], '') -%}
{%- set v_layout = og_def(p['layout'], 'cards') -%}
{%- set c_6 -%}
{%- set c_5 -%}
{%- if og_t(og_eq(v_layout, 'numbered')) %}
{%- set c_1 -%}
{{ og_text(v_number) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'flex size-8 shrink-0 items-center justify-center rounded bg-primary text-sm font-medium text-primary-foreground'}, 'children': c_1}) }}
{%- endif %}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_text(v_title) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 2, 'Size': 'lg', 'Weight': 'semibold'}, 'children': c_2}) }}
{%- if og_t(v_text) %}
{%- set c_3 -%}
{{ og_text(v_text) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '0'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'start'}, 'children': c_5}) }}
{{ og_slot(og_def(children, none))|safe }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '6', 'Align': 'stretch', 'Class': og_s(('rounded bg-card inset-ring inset-ring-border p-6' if og_t(og_eq(v_layout, 'cards')) else 'border-t border-border pt-6')), 'Attrs': og_attrs(['data-slot', 'step'])}, 'children': c_6}) }}
Props
Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.
One step of a long form: an optional number, a heading (h2) and a line of text over the fields (`children`). Axes: layout (cards: the step in a card, numbered: a number beside the heading and a line between steps).
| Prop | Type | Default | Description |
|---|---|---|---|
| number (required) | string | - | the number of the step (shown in the numbered layout) |
| title (required) | string | - | |
| text | string | "" | |
| layout | "cards" | "numbered" | "cards" |