Skip to content
Navigation Core Stable

Stepper

.md

A multi-step progress indicator on light rails: each completed step sends a single sweep of light down the rail to the next, the current bullet breathes a soft halo, and each check draws itself.

Available for Svelte 5, React, and Vue 3.

Preview

Installation

pnpm add fancy-ui-svelte
import { Stepper } from "fancy-ui-svelte";

Usage

svelte
<script lang="ts">
	import { Stepper, Step } from "fancy-ui-svelte";

	const steps = [
		{ label: "Account", description: "Sign-in details" },
		{ label: "Workspace", description: "Name and region" },
		{ label: "Invite", description: "Bring your team" },
		{ label: "Launch", description: "Review and go" },
	];

	let current = $state(2);
</script>

<div
	class="w-full max-w-2xl rounded-[22px] border border-black/[0.08] bg-[#f4f4f5] p-1.5 dark:border-white/[0.08] dark:bg-[#0b0b0c]"
>
	<div
		class="rounded-2xl border border-black/[0.08] bg-[#fafafa] shadow-[0_1px_2px_rgb(0_0_0/0.04)] dark:border-white/[0.06] dark:bg-[#141416] dark:shadow-none"
	>
		<div
			class="flex items-center justify-between border-b border-black/[0.06] px-5 py-3 dark:border-white/[0.06]"
		>
			<span class="text-foreground text-[13px] font-medium">New workspace</span>
			<span class="text-muted-foreground font-mono text-[11px] tabular-nums">
				{String(current + 1).padStart(2, "0")} / {String(steps.length).padStart(2, "0")}
			</span>
		</div>

		<div class="px-4 pt-7 pb-6 sm:px-6">
			<Stepper bind:current>
				{#each steps as step (step.label)}
					<Step label={step.label} description={step.description} />
				{/each}
			</Stepper>
		</div>

		<div
			class="flex items-center justify-between border-t border-black/[0.06] px-5 py-3 dark:border-white/[0.06]"
		>
			<button
				type="button"
				class="text-muted-foreground hover:text-foreground rounded-md px-2.5 py-1.5 text-[13px] transition-colors disabled:pointer-events-none disabled:opacity-40"
				disabled={current === 0}
				onclick={() => (current = Math.max(0, current - 1))}
			>
				Back
			</button>
			<button
				type="button"
				class="rounded-lg border border-black/[0.08] bg-white px-3.5 py-1.5 text-[13px] font-medium text-neutral-900 shadow-[0_1px_2px_rgb(0_0_0/0.06)] transition-colors hover:bg-neutral-50 dark:border-white/[0.1] dark:bg-white/[0.06] dark:text-neutral-100 dark:shadow-none dark:hover:bg-white/[0.1]"
				onclick={() => (current = current === steps.length - 1 ? 0 : current + 1)}
			>
				{current === steps.length - 1 ? "Start over" : "Continue"}
			</button>
		</div>
	</div>
</div>

Examples

Basic Usage

A four-step wizard in a nested frame; Continue and Back run the light along the rails.

Vertical Stepper

Stacked in a column; the rails fill top to bottom.

Clickable Steps

Jump to any step; a jump across several steps lights the rails one after another.

With Descriptions

Vertical, clickable, with a secondary line under each label.

Props

PropTypeDefaultDescription
current number0The active step's 0-based index. Bindable.
onCurrentChange (current: number) => void-Called with the new index whenever it changes, however the change happened.
orientation "horizontal" | "vertical""horizontal"The rail's stacking axis.
clickable booleanfalseWhether steps render as buttons a reader can click to jump between them.
onStepClick (index: number) => void-Called with a step's index when it's activated by a click. Only fires when clickable.
class string-Additional CSS classes, merged onto the root.
ref HTMLOListElement | nullnullBindable reference to the root element.
sound booleanfalsePlays select when a clickable step changes the current step, once the user has enabled sound
Step.label *string-The step's primary label.
Step.description string-Optional secondary line shown under the label.
Step.class string-Additional CSS classes, merged onto the step's li.
Step.ref HTMLLIElement | nullnullBindable reference to the step's li element.

Slots

SlotDescription
children The Steps.
Step.children Overrides the bullet's default content (checkmark / number / outline).