Skip to content
ui8kit

block / onboarding

Stepper

A multi-step form header with the current step.

Install

npx ui8kit add stepper

Pulls in: button, compose, group, icon-badge, inline, kit-box, kit-button, kit-text, list, list-item, lucide-icon, section-frame, stack, steps-list, text, title, utils

Preview

Set up your workspace

Step 2 of 4

  1. 1

    Pick a plan

  2. 2

    Connect your data

  3. 3

    Choose the blocks

  4. 4

    Publish

Connect your data

Point the site at your collections and content.

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 stepper
blocks/stepper.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 multi-step form header: the steps with the current one marked (aria-current step), and the current step's
  text with back and next buttons. Axes: layout (horizontal, vertical), marker (number, icon), summary (show,
  hide).
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Step } from "./steps-list.types";

  export type StepperProps = {
    id: string;
    title: string;
    steps: Step[];
    current?: number;
    stepLabel: string;
    back: string;
    next: string;
    layout?: "horizontal" | "vertical";
    marker?: "number" | "icon";
    summary?: "show" | "hide";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Button from "../compose/Button.svelte";
  import Group from "../compose/Group.svelte";
  import IconBadge from "../compose/IconBadge.svelte";
  import Inline from "../compose/Inline.svelte";
  import List from "../compose/List.svelte";
  import ListItem from "../compose/ListItem.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import Title from "../compose/Title.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { cn, tpl } from "../utils";

  let {
    id,
    title,
    steps,
    current = 2,
    stepLabel,
    back,
    next,
    layout = "horizontal",
    marker = "number",
    summary = "show",
    landmarkLabel,
  }: StepperProps = $props();
</script>

<SectionFrame id={id} title={title} measure="3xl" landmarkLabel={landmarkLabel}>
  {#if ((steps?.length ?? 0) > 0)}
    <Stack gap="6" align="stretch" data-slot="stepper">
      <Text size="sm" class="text-muted-foreground">
        {tpl(stepLabel, current, (steps?.length ?? 0))}
      </Text>
      <List
        tag="ol"
        class={cn(
          "m-0 flex list-none gap-4 p-0",
          (((layout as string) === "vertical") ? "flex-col" : "flex-col sm:flex-row")
        )}
        data-slot="items"
      >
        {#each steps as s, i (s.id)}
          <ListItem
            class="flex flex-1 items-center gap-4"
            aria-current={(((i + 1) === current) ? "step" : undefined)}
            data-slot="item"
          >
            <IconBadge
              variant={(((i + 1) < (current + 1)) ? "primary" : "outline")}
              size="sm"
              class={(((i + 1) < (current + 1)) ? "text-sm" : "text-sm text-muted-foreground")}
            >
              {#if ((marker as string) === "icon")}
                <LucideIcon name={s.icon} size={16} />
              {:else}
                <Inline class="text-sm font-bold">
                  {((i + 1) == null ? undefined : String((i + 1)))}
                </Inline>
              {/if}
            </IconBadge>
            <Text size="sm" weight={(((i + 1) === current) ? "bold" : "semibold")}>
              {s.title}
            </Text>
          </ListItem>
        {/each}
      </List>
      {#if ((summary as string) === "show")}
        {#each steps as s, i (s.id)}
          {#if ((i + 1) === current)}
            <Stack gap="2" class="rounded bg-card p-6 inset-ring inset-ring-border" data-slot="step-summary">
              <Title as={3} size="xl" weight="bold">
                {s.title}
              </Title>
              <Text size="sm" class="text-muted-foreground">
                {s.text}
              </Text>
              <Group gap="2" class="pt-2">
                <Button variant="outline" size="sm" type="button">
                  {back}
                </Button>
                <Button variant="default" size="sm" type="button">
                  {next}
                </Button>
              </Group>
            </Stack>
          {/if}
        {/each}
      {/if}
    </Stack>
  {/if}
</SectionFrame>

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 stepper
blocks/stepper.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 multi-step form header: the steps with the current one marked (aria-current step), and the current step's
 * text with back and next buttons. Axes: layout (horizontal, vertical), marker (number, icon), summary (show,
 * hide).
 */
import { Fragment, type ReactNode } from "react";
import { Button, Group, IconBadge, Inline, List, ListItem, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { Step } from "./steps-list.types";

export type StepperProps = {
  id: string;
  title: string;
  steps: Step[];
  current?: number;
  stepLabel: string;
  back: string;
  next: string;
  layout?: "horizontal" | "vertical";
  marker?: "number" | "icon";
  summary?: "show" | "hide";
  landmarkLabel?: string;
};

export function Stepper({
  id,
  title,
  steps,
  current = 2,
  stepLabel,
  back,
  next,
  layout = "horizontal",
  marker = "number",
  summary = "show",
  landmarkLabel,
}: StepperProps) {
  return (
    <SectionFrame id={id} title={title} measure="3xl" landmarkLabel={landmarkLabel}>
      {((steps?.length ?? 0) > 0) ? (
        <Stack gap="6" align="stretch" data-slot="stepper">
          <Text size="sm" className="text-muted-foreground">
            {tpl(stepLabel, current, (steps?.length ?? 0))}
          </Text>
          <List
            tag="ol"
            className={cn(
              "m-0 flex list-none gap-4 p-0",
              (((layout as string) === "vertical") ? "flex-col" : "flex-col sm:flex-row")
            )}
            data-slot="items"
          >
            {(steps ?? []).map((s, i) => (
              <ListItem key={s.id}
                className="flex flex-1 items-center gap-4"
                aria-current={(((i + 1) === current) ? "step" : undefined)}
                data-slot="item"
              >
                <IconBadge
                  variant={(((i + 1) < (current + 1)) ? "primary" : "outline")}
                  size="sm"
                  className={(((i + 1) < (current + 1)) ? "text-sm" : "text-sm text-muted-foreground")}
                >
                  {((marker as string) === "icon") ? (
                    <LucideIcon name={s.icon} size={16} />
                  ) : (
                    <Inline className="text-sm font-bold">
                      {((i + 1) == null ? undefined : String((i + 1)))}
                    </Inline>
                  )}
                </IconBadge>
                <Text size="sm" weight={(((i + 1) === current) ? "bold" : "semibold")}>
                  {s.title}
                </Text>
              </ListItem>
            ))}
          </List>
          {((summary as string) === "show") ? (
            <>
              {(steps ?? []).map((s, i) => (
                <Fragment key={s.id}>
                  {((i + 1) === current) ? (
                    <Stack gap="2" className="rounded bg-card p-6 inset-ring inset-ring-border" data-slot="step-summary">
                      <Title as={3} size="xl" weight="bold">
                        {s.title}
                      </Title>
                      <Text size="sm" className="text-muted-foreground">
                        {s.text}
                      </Text>
                      <Group gap="2" className="pt-2">
                        <Button variant="outline" size="sm" type="button">
                          {back}
                        </Button>
                        <Button variant="default" size="sm" type="button">
                          {next}
                        </Button>
                      </Group>
                    </Stack>
                  ) : null}
                </Fragment>
              ))}
            </>
          ) : null}
        </Stack>
      ) : null}
    </SectionFrame>
  );
}

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 stepper
blocks/stepper.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 multi-step form header: the steps with the current one marked (aria-current step), and the current step's
  text with back and next buttons. Axes: layout (horizontal, vertical), marker (number, icon), summary (show,
  hide).
-->
<script lang="ts">
import type { Step } from "./steps-list.types";

export type StepperProps = {
  id: string;
  title: string;
  steps: Step[];
  current?: number;
  stepLabel: string;
  back: string;
  next: string;
  layout?: "horizontal" | "vertical";
  marker?: "number" | "icon";
  summary?: "show" | "hide";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Button from "../compose/Button.vue";
import Group from "../compose/Group.vue";
import IconBadge from "../compose/IconBadge.vue";
import Inline from "../compose/Inline.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import SectionFrame from "../components/section-frame.vue";
import { cn, tpl } from "../utils";

const {
  id,
  title,
  steps,
  current = 2,
  stepLabel,
  back,
  next,
  layout = "horizontal",
  marker = "number",
  summary = "show",
  landmarkLabel,
} = defineProps<StepperProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" measure="3xl" :landmarkLabel="landmarkLabel">
    <Stack v-if="((steps?.length ?? 0) > 0)" gap="6" align="stretch" data-slot="stepper">
      <Text size="sm" class="text-muted-foreground">
        {{ tpl(stepLabel, current, (steps?.length ?? 0)) }}
      </Text>
      <List
        tag="ol"
        :class="cn(
          'm-0 flex list-none gap-4 p-0',
          (((layout as string) === 'vertical') ? 'flex-col' : 'flex-col sm:flex-row')
        )"
        data-slot="items"
      >
        <ListItem v-for="(s, i) in steps" :key="s.id"
          class="flex flex-1 items-center gap-4"
          :aria-current="(((i + 1) === current) ? 'step' : undefined)"
          data-slot="item"
        >
          <IconBadge
            :variant="(((i + 1) < (current + 1)) ? 'primary' : 'outline')"
            size="sm"
            :class="(((i + 1) < (current + 1)) ? 'text-sm' : 'text-sm text-muted-foreground')"
          >
            <LucideIcon v-if="((marker as string) === 'icon')" :name="s.icon" :size="16" />
            <Inline v-else class="text-sm font-bold">
              {{ ((i + 1) == null ? undefined : String((i + 1))) }}
            </Inline>
          </IconBadge>
          <Text size="sm" :weight="(((i + 1) === current) ? 'bold' : 'semibold')">
            {{ s.title }}
          </Text>
        </ListItem>
      </List>
      <template v-if="((summary as string) === 'show')">
        <template v-for="(s, i) in steps" :key="s.id">
          <Stack
            v-if="((i + 1) === current)"
            gap="2"
            class="rounded bg-card p-6 inset-ring inset-ring-border"
            data-slot="step-summary"
          >
            <Title :as="3" size="xl" weight="bold">
              {{ s.title }}
            </Title>
            <Text size="sm" class="text-muted-foreground">
              {{ s.text }}
            </Text>
            <Group gap="2" class="pt-2">
              <Button variant="outline" size="sm" type="button">
                {{ back }}
              </Button>
              <Button variant="default" size="sm" type="button">
                {{ next }}
              </Button>
            </Group>
          </Stack>
        </template>
      </template>
    </Stack>
  </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 stepper
blocks/stepper.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 multi-step form header: the steps with the current one marked (aria-current step), and the current step's
 * text with back and next buttons. Axes: layout (horizontal, vertical), marker (number, icon), summary (show,
 * hide).
 */
import { For, type JSX } from "solid-js";
import { Button, Group, IconBadge, Inline, List, ListItem, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { Step } from "./steps-list.types";

export type StepperProps = {
  id: string;
  title: string;
  steps: Step[];
  current?: number;
  stepLabel: string;
  back: string;
  next: string;
  layout?: "horizontal" | "vertical";
  marker?: "number" | "icon";
  summary?: "show" | "hide";
  landmarkLabel?: string;
};

export function Stepper({
  id,
  title,
  steps,
  current = 2,
  stepLabel,
  back,
  next,
  layout = "horizontal",
  marker = "number",
  summary = "show",
  landmarkLabel,
}: StepperProps) {
  return (
    <SectionFrame id={id} title={title} measure="3xl" landmarkLabel={landmarkLabel}>
      {((steps?.length ?? 0) > 0) ? (
        <Stack gap="6" align="stretch" data-slot="stepper">
          <Text size="sm" class="text-muted-foreground">
            {tpl(stepLabel, current, (steps?.length ?? 0))}
          </Text>
          <List
            tag="ol"
            class={cn(
              "m-0 flex list-none gap-4 p-0",
              (((layout as string) === "vertical") ? "flex-col" : "flex-col sm:flex-row")
            )}
            data-slot="items"
          >
            <For each={steps ?? []}>{(s, iOf) => { const i = iOf(); return (
              <ListItem
                class="flex flex-1 items-center gap-4"
                aria-current={(((i + 1) === current) ? "step" : undefined)}
                data-slot="item"
              >
                <IconBadge
                  variant={(((i + 1) < (current + 1)) ? "primary" : "outline")}
                  size="sm"
                  class={(((i + 1) < (current + 1)) ? "text-sm" : "text-sm text-muted-foreground")}
                >
                  {((marker as string) === "icon") ? (
                    <LucideIcon name={s.icon} size={16} />
                  ) : (
                    <Inline class="text-sm font-bold">
                      {((i + 1) == null ? undefined : String((i + 1)))}
                    </Inline>
                  )}
                </IconBadge>
                <Text size="sm" weight={(((i + 1) === current) ? "bold" : "semibold")}>
                  {s.title}
                </Text>
              </ListItem>
            ); }}</For>
          </List>
          {((summary as string) === "show") ? (
            <>
              <For each={steps ?? []}>{(s, iOf) => { const i = iOf(); return (
                <>
                  {((i + 1) === current) ? (
                    <Stack gap="2" class="rounded bg-card p-6 inset-ring inset-ring-border" data-slot="step-summary">
                      <Title as={3} size="xl" weight="bold">
                        {s.title}
                      </Title>
                      <Text size="sm" class="text-muted-foreground">
                        {s.text}
                      </Text>
                      <Group gap="2" class="pt-2">
                        <Button variant="outline" size="sm" type="button">
                          {back}
                        </Button>
                        <Button variant="default" size="sm" type="button">
                          {next}
                        </Button>
                      </Group>
                    </Stack>
                  ) : null}
                </>
              ); }}</For>
            </>
          ) : null}
        </Stack>
      ) : null}
    </SectionFrame>
  );
}

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 stepper
blocks/stepper.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/stepper.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/compose"
	"github.com/ui8kit/codegen/generated/templ/icons"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// StepperProps are the props of Stepper; the values are the JSON shapes of the TypeScript props.
type StepperProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Steps any `json:"steps"`
	Current any `json:"current"`
	StepLabel any `json:"stepLabel"`
	Back any `json:"back"`
	Next any `json:"next"`
	Layout any `json:"layout"`
	Marker any `json:"marker"`
	Summary any `json:"summary"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A multi-step form header: the steps with the current one marked (aria-current step), and the current step's text with back and next buttons. Axes: layout (horizontal, vertical), marker (number, icon), summary (show, hide).
templ Stepper(p StepperProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vSteps := p.Steps }}
	{{ vCurrent := uiutils.Def(p.Current, float64(2)) }}
	{{ vStepLabel := p.StepLabel }}
	{{ vBack := p.Back }}
	{{ vNext := p.Next }}
	{{ vLayout := uiutils.Def(p.Layout, "horizontal") }}
	{{ vMarker := uiutils.Def(p.Marker, "number") }}
	{{ vSummary := uiutils.Def(p.Summary, "show") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Measure: "3xl", LandmarkLabel: vLandmarkLabel}) {
		if uiutils.Gt(uiutils.Len(vSteps), float64(0)) {
			@compose.Stack(compose.StackProps{Gap: "6", Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "stepper")}}) {
				@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
					{ uiutils.Text(uiutils.Tpl(vStepLabel, vCurrent, uiutils.Len(vSteps))) }
				}
				@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ol", Class: uiutils.S(uiutils.Cnv("m-0 flex list-none gap-4 p-0", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "vertical")), "flex-col", "flex-col sm:flex-row"))), Attrs: uiutils.Attrs("data-slot", "items")}}) {
					for vI, vS := range uiutils.L(vSteps) {
						@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex flex-1 items-center gap-4", Attrs: uiutils.Attrs("aria-current", uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Add(float64(vI), float64(1)), vCurrent)), "step", nil), "data-slot", "item")}}) {
							@compose.IconBadge(compose.IconBadgeProps{Variant: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Lt(uiutils.Add(float64(vI), float64(1)), uiutils.Add(vCurrent, float64(1)))), "primary", "outline")), Size: "sm", TextProps: text.TextProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Lt(uiutils.Add(float64(vI), float64(1)), uiutils.Add(vCurrent, float64(1)))), "text-sm", "text-sm text-muted-foreground"))}}) {
								if uiutils.Eq(vMarker, "icon") {
									@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vS, "icon")), Size: 16})
								} else {
									@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-sm font-bold"}}) {
										{ uiutils.Text(uiutils.Str(uiutils.Add(float64(vI), float64(1)))) }
									}
								}
							}
							@compose.Text(compose.TextProps{Size: "sm", Weight: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Add(float64(vI), float64(1)), vCurrent)), "bold", "semibold")), TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.Get(vS, "title")) }
							}
						}
					}
				}
				if uiutils.Eq(vSummary, "show") {
					for vI, vS := range uiutils.L(vSteps) {
						if uiutils.Eq(uiutils.Add(float64(vI), float64(1)), vCurrent) {
							@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Class: "rounded bg-card p-6 inset-ring inset-ring-border", Attrs: uiutils.Attrs("data-slot", "step-summary")}}) {
								@compose.Title(compose.TitleProps{As: "3", Size: "xl", Weight: "bold", TextProps: text.TextProps{}}) {
									{ uiutils.Text(uiutils.Get(vS, "title")) }
								}
								@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
									{ uiutils.Text(uiutils.Get(vS, "text")) }
								}
								@compose.Group(compose.GroupProps{Gap: "2", BoxProps: box.BoxProps{Class: "pt-2"}}) {
									@compose.Button(compose.ButtonProps{Variant: "outline", Size: "sm", ButtonProps: button.ButtonProps{Type: "button"}}) {
										{ uiutils.Text(vBack) }
									}
									@compose.Button(compose.ButtonProps{Variant: "default", Size: "sm", ButtonProps: button.ButtonProps{Type: "button"}}) {
										{ uiutils.Text(vNext) }
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

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 stepper
blocks/stepper.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/stepper.json
    A multi-step form header: the steps with the current one marked (aria-current step), and the current step's text with back and next buttons. Axes: layout (horizontal, vertical), marker (number, icon), summary (show, hide).
    Props (p): id, title, steps, current, stepLabel, back, next, layout, marker, summary, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_steps = (p.steps ?? null) -%}
{%- set v_current = (p.current ?? 2) -%}
{%- set v_stepLabel = (p.stepLabel ?? null) -%}
{%- set v_back = (p.back ?? null) -%}
{%- set v_next = (p.next ?? null) -%}
{%- set v_layout = (p.layout ?? 'horizontal') -%}
{%- set v_marker = (p.marker ?? 'number') -%}
{%- set v_summary = (p.summary ?? 'show') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_14 -%}
  {%- if og_t(og_gt(og_len(v_steps), 0)) %}
    {%- set c_13 -%}
      {%- set c_1 -%}
        {{ og_text(og_tpl(v_stepLabel, [v_current, og_len(v_steps)])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_1}, with_context = false) }}
      {%- set c_6 -%}
        {%- for v_s in og_l(v_steps) %}
          {%- set v_i = loop.index0 -%}
          {%- set c_5 -%}
            {%- set c_3 -%}
              {%- if og_t(og_eq(v_marker, 'icon')) %}
                {{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_s, ['icon'])), 'size': 16}, with_context = false) }}
              {%- else %}
                {%- set c_2 -%}
                  {{ og_text(og_str(og_add(v_i, 1))) }}
                {%- endset -%}
                {{ include('compose/Inline.html.twig', {'class': 'text-sm font-bold', 'children': c_2}, with_context = false) }}
              {%- endif %}
            {%- endset -%}
            {{ include('compose/IconBadge.html.twig', {'variant': og_s((og_t(og_lt(og_add(v_i, 1), og_add(v_current, 1))) ? 'primary' : 'outline')), 'size': 'sm', 'class': og_s((og_t(og_lt(og_add(v_i, 1), og_add(v_current, 1))) ? 'text-sm' : 'text-sm text-muted-foreground')), 'children': c_3}, with_context = false) }}
            {%- set c_4 -%}
              {{ og_text(og_get(v_s, ['title'])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': og_s((og_t(og_eq(og_add(v_i, 1), v_current)) ? 'bold' : 'semibold')), 'children': c_4}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/ListItem.html.twig', {'class': 'flex flex-1 items-center gap-4', 'attrs': og_attrs(['aria-current', (og_t(og_eq(og_add(v_i, 1), v_current)) ? 'step' : null), 'data-slot', 'item']), 'children': c_5}, with_context = false) }}
        {%- endfor %}
      {%- endset -%}
      {{ include('compose/List.html.twig', {'tag': 'ol', 'class': og_s(og_cnv(['m-0 flex list-none gap-4 p-0', (og_t(og_eq(v_layout, 'vertical')) ? 'flex-col' : 'flex-col sm:flex-row')])), 'attrs': og_attrs(['data-slot', 'items']), 'children': c_6}, with_context = false) }}
      {%- if og_t(og_eq(v_summary, 'show')) %}
        {%- for v_s in og_l(v_steps) %}
          {%- set v_i = loop.index0 -%}
          {%- if og_t(og_eq(og_add(v_i, 1), v_current)) %}
            {%- set c_12 -%}
              {%- set c_7 -%}
                {{ og_text(og_get(v_s, ['title'])) }}
              {%- endset -%}
              {{ include('compose/Title.html.twig', {'as': 3, 'size': 'xl', 'weight': 'bold', 'children': c_7}, with_context = false) }}
              {%- set c_8 -%}
                {{ og_text(og_get(v_s, ['text'])) }}
              {%- endset -%}
              {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_8}, with_context = false) }}
              {%- set c_11 -%}
                {%- set c_9 -%}
                  {{ og_text(v_back) }}
                {%- endset -%}
                {{ include('compose/Button.html.twig', {'variant': 'outline', 'size': 'sm', 'type': 'button', 'children': c_9}, with_context = false) }}
                {%- set c_10 -%}
                  {{ og_text(v_next) }}
                {%- endset -%}
                {{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'sm', 'type': 'button', 'children': c_10}, with_context = false) }}
              {%- endset -%}
              {{ include('compose/Group.html.twig', {'gap': '2', 'class': 'pt-2', 'children': c_11}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Stack.html.twig', {'gap': '2', 'class': 'rounded bg-card p-6 inset-ring inset-ring-border', 'attrs': og_attrs(['data-slot', 'step-summary']), 'children': c_12}, with_context = false) }}
          {%- endif %}
        {%- endfor %}
      {%- endif %}
    {%- endset -%}
    {{ include('compose/Stack.html.twig', {'gap': '6', 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'stepper']), 'children': c_13}, with_context = false) }}
  {%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'measure': '3xl', 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_14)}, 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 stepper
blocks/stepper.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/stepper.json
    A multi-step form header: the steps with the current one marked (aria-current step), and the current step's text with back and next buttons. Axes: layout (horizontal, vertical), marker (number, icon), summary (show, hide).
    Props (p): id, title, steps, current, stepLabel, back, next, layout, marker, summary, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_steps = ($p['steps'] ?? null)}
{var $v_current = ($p['current'] ?? 2)}
{var $v_stepLabel = ($p['stepLabel'] ?? null)}
{var $v_back = ($p['back'] ?? null)}
{var $v_next = ($p['next'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'horizontal')}
{var $v_marker = ($p['marker'] ?? 'number')}
{var $v_summary = ($p['summary'] ?? 'show')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_14}
  {if og_t(og_gt(og_len($v_steps), 0))}
    {capture $c_13}
      {capture $c_1}
        {=og_text(og_tpl($v_stepLabel, [$v_current, og_len($v_steps)]))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_1])|noescape}
      {capture $c_6}
        {foreach og_l($v_steps) as $v_s}
          {var $v_i = $iterator->counter0}
          {capture $c_5}
            {capture $c_3}
              {if og_t(og_eq($v_marker, 'icon'))}
                {=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_s, ['icon'])), 'size' => 16])|noescape}
              {else}
                {capture $c_2}
                  {=og_text(og_str(og_add($v_i, 1)))}
                {/capture}
                {=og_include('compose/Inline.latte', ['class' => 'text-sm font-bold', 'children' => (string) $c_2])|noescape}
              {/if}
            {/capture}
            {=og_include('compose/IconBadge.latte', ['variant' => og_s((og_t(og_lt(og_add($v_i, 1), og_add($v_current, 1))) ? 'primary' : 'outline')), 'size' => 'sm', 'class' => og_s((og_t(og_lt(og_add($v_i, 1), og_add($v_current, 1))) ? 'text-sm' : 'text-sm text-muted-foreground')), 'children' => (string) $c_3])|noescape}
            {capture $c_4}
              {=og_text(og_get($v_s, ['title']))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => og_s((og_t(og_eq(og_add($v_i, 1), $v_current)) ? 'bold' : 'semibold')), 'children' => (string) $c_4])|noescape}
          {/capture}
          {=og_include('compose/ListItem.latte', ['class' => 'flex flex-1 items-center gap-4', 'attrs' => og_attrs(['aria-current', (og_t(og_eq(og_add($v_i, 1), $v_current)) ? 'step' : null), 'data-slot', 'item']), 'children' => (string) $c_5])|noescape}
        {/foreach}
      {/capture}
      {=og_include('compose/List.latte', ['tag' => 'ol', 'class' => og_s(og_cnv(['m-0 flex list-none gap-4 p-0', (og_t(og_eq($v_layout, 'vertical')) ? 'flex-col' : 'flex-col sm:flex-row')])), 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_6])|noescape}
      {if og_t(og_eq($v_summary, 'show'))}
        {foreach og_l($v_steps) as $v_s}
          {var $v_i = $iterator->counter0}
          {if og_t(og_eq(og_add($v_i, 1), $v_current))}
            {capture $c_12}
              {capture $c_7}
                {=og_text(og_get($v_s, ['title']))}
              {/capture}
              {=og_include('compose/Title.latte', ['as' => 3, 'size' => 'xl', 'weight' => 'bold', 'children' => (string) $c_7])|noescape}
              {capture $c_8}
                {=og_text(og_get($v_s, ['text']))}
              {/capture}
              {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_8])|noescape}
              {capture $c_11}
                {capture $c_9}
                  {=og_text($v_back)}
                {/capture}
                {=og_include('compose/Button.latte', ['variant' => 'outline', 'size' => 'sm', 'type' => 'button', 'children' => (string) $c_9])|noescape}
                {capture $c_10}
                  {=og_text($v_next)}
                {/capture}
                {=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'sm', 'type' => 'button', 'children' => (string) $c_10])|noescape}
              {/capture}
              {=og_include('compose/Group.latte', ['gap' => '2', 'class' => 'pt-2', 'children' => (string) $c_11])|noescape}
            {/capture}
            {=og_include('compose/Stack.latte', ['gap' => '2', 'class' => 'rounded bg-card p-6 inset-ring inset-ring-border', 'attrs' => og_attrs(['data-slot', 'step-summary']), 'children' => (string) $c_12])|noescape}
          {/if}
        {/foreach}
      {/if}
    {/capture}
    {=og_include('compose/Stack.latte', ['gap' => '6', 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'stepper']), 'children' => (string) $c_13])|noescape}
  {/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'measure' => '3xl', 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_14)])|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 stepper
blocks/stepper.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/stepper.json
    A multi-step form header: the steps with the current one marked (aria-current step), and the current step's text with back and next buttons. Axes: layout (horizontal, vertical), marker (number, icon), summary (show, hide).
    Props (p): id, title, steps, current, stepLabel, back, next, layout, marker, summary, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_steps = og_def(p['steps'], none) -%}
{%- set v_current = og_def(p['current'], 2) -%}
{%- set v_stepLabel = og_def(p['stepLabel'], none) -%}
{%- set v_back = og_def(p['back'], none) -%}
{%- set v_next = og_def(p['next'], none) -%}
{%- set v_layout = og_def(p['layout'], 'horizontal') -%}
{%- set v_marker = og_def(p['marker'], 'number') -%}
{%- set v_summary = og_def(p['summary'], 'show') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_14 -%}
  {%- if og_t(og_gt(og_len(v_steps), 0)) %}
    {%- set c_13 -%}
      {%- set c_1 -%}
        {{ og_text(og_tpl(v_stepLabel, [v_current, og_len(v_steps)])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_1}) }}
      {%- set c_6 -%}
        {%- for v_s in og_l(v_steps) %}
          {%- set v_i = loop.index0 -%}
          {%- set c_5 -%}
            {%- set c_3 -%}
              {%- if og_t(og_eq(v_marker, 'icon')) %}
                {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_s, ['icon'])), 'Size': 16}}) }}
              {%- else %}
                {%- set c_2 -%}
                  {{ og_text(og_str(og_add(v_i, 1))) }}
                {%- endset -%}
                {{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-sm font-bold'}, 'children': c_2}) }}
              {%- endif %}
            {%- endset -%}
            {{ og_include('compose/icon-badge.html.j2', {'p': {'Variant': og_s(('primary' if og_t(og_lt(og_add(v_i, 1), og_add(v_current, 1))) else 'outline')), 'Size': 'sm', 'Class': og_s(('text-sm' if og_t(og_lt(og_add(v_i, 1), og_add(v_current, 1))) else 'text-sm text-muted-foreground'))}, 'children': c_3}) }}
            {%- set c_4 -%}
              {{ og_text(og_get(v_s, ['title'])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': og_s(('bold' if og_t(og_eq(og_add(v_i, 1), v_current)) else 'semibold'))}, 'children': c_4}) }}
          {%- endset -%}
          {{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex flex-1 items-center gap-4', 'Attrs': og_attrs(['aria-current', ('step' if og_t(og_eq(og_add(v_i, 1), v_current)) else none), 'data-slot', 'item'])}, 'children': c_5}) }}
        {%- endfor %}
      {%- endset -%}
      {{ og_include('compose/list.html.j2', {'p': {'Tag': 'ol', 'Class': og_s(og_cnv(['m-0 flex list-none gap-4 p-0', ('flex-col' if og_t(og_eq(v_layout, 'vertical')) else 'flex-col sm:flex-row')])), 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_6}) }}
      {%- if og_t(og_eq(v_summary, 'show')) %}
        {%- for v_s in og_l(v_steps) %}
          {%- set v_i = loop.index0 -%}
          {%- if og_t(og_eq(og_add(v_i, 1), v_current)) %}
            {%- set c_12 -%}
              {%- set c_7 -%}
                {{ og_text(og_get(v_s, ['title'])) }}
              {%- endset -%}
              {{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'xl', 'Weight': 'bold'}, 'children': c_7}) }}
              {%- set c_8 -%}
                {{ og_text(og_get(v_s, ['text'])) }}
              {%- endset -%}
              {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_8}) }}
              {%- set c_11 -%}
                {%- set c_9 -%}
                  {{ og_text(v_back) }}
                {%- endset -%}
                {{ og_include('compose/button.html.j2', {'p': {'Variant': 'outline', 'Size': 'sm', 'Type': 'button'}, 'children': c_9}) }}
                {%- set c_10 -%}
                  {{ og_text(v_next) }}
                {%- endset -%}
                {{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'sm', 'Type': 'button'}, 'children': c_10}) }}
              {%- endset -%}
              {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Class': 'pt-2'}, 'children': c_11}) }}
            {%- endset -%}
            {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Class': 'rounded bg-card p-6 inset-ring inset-ring-border', 'Attrs': og_attrs(['data-slot', 'step-summary'])}, 'children': c_12}) }}
          {%- endif %}
        {%- endfor %}
      {%- endif %}
    {%- endset -%}
    {{ og_include('compose/stack.html.j2', {'p': {'Gap': '6', 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'stepper'])}, 'children': c_13}) }}
  {%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'measure': '3xl', 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_14)}) }}

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 multi-step form header: the steps with the current one marked (aria-current step), and the current step's text with back and next buttons. Axes: layout (horizontal, vertical), marker (number, icon), summary (show, hide).

Props of Stepper
PropTypeDefault Description
id (required)string-
title (required)string-
steps (required)Step[]-
current number2the number of the current step, from 1
stepLabel (required)string-template of the progress line, e.g. `Step {0} of {1}`
back (required)string-
next (required)string-
layout "horizontal" | "vertical""horizontal"
marker "number" | "icon""number"
summary "show" | "hide""show"
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