skip section navigation

Steps

show a plan all at once, or guide someone through one part at a time. your app owns the work and the rules for moving on.

  1. collect articles

    save the articles you want to share.

    Completed

  2. review links

    open each link before sending the collection.

  3. share collection

    sharing opens after the review.

    Unavailable

usage

svelte
<script lang="ts">
import { Steps } from '@ciabi/loafkit-ui';
</script>

{#snippet listCollect()}<p>save the articles you want to share.</p>{/snippet}
{#snippet listReview()}<p>open each link before sending the collection.</p>{/snippet}
{#snippet listPublish()}<p>sharing opens after the review.</p>{/snippet}
<Steps steps={[
	{ id: 'collect', title: 'collect articles', children: listCollect, completed: true },
	{ id: 'review', title: 'review links', children: listReview },
	{ id: 'publish', title: 'share collection', children: listPublish, disabled: true }
]} />

completed and disabled are display states here. they do not run or validate the work described by a step.

composition

  • Steps
    • steps
      • children() (per step)

choose a focused step

  1. collect

    keep one useful article for the weekend.

current step: collect

svelte
<script lang="ts">
import { Steps } from '@ciabi/loafkit-ui';
let focusStep = $state('collect');
let collected = $state(false);
</script>

{#snippet focusCollect()}
	<p>keep one useful article for the weekend.</p>
	<button type="button" onclick={() => collected = !collected}>{collected ? 'mark as unfinished' : 'mark collection ready'}</button>
{/snippet}
{#snippet focusReview()}<p>check the saved links, then share the collection.</p>{/snippet}
<Steps variant="focused" showStepButtons bind:currentStep={focusStep} steps={[
	{ id: 'collect', title: 'collect', children: focusCollect, completed: collected },
	{ id: 'review', title: 'review', children: focusReview, disabled: !collected }
]} />
<p role="status">current step: {focusStep}</p>

marking collect completed does not advance it.

keep progress in view

  1. choose

    pick an article you have time for.

  2. read

    read it without opening another tab.

  3. keep a note

    keep one detail you want to remember.

svelte
<script lang="ts">
import { Steps } from '@ciabi/loafkit-ui';
let readingStage = $state(0);
const readingStages = ['choose', 'read', 'note'];
</script>

{#snippet horizontalChoose()}<p>pick an article you have time for.</p>{/snippet}
{#snippet horizontalRead()}<p>read it without opening another tab.</p>{/snippet}
{#snippet horizontalNote()}<p>keep one detail you want to remember.</p>{/snippet}
<Steps variant="horizontal" currentStep={readingStages[readingStage]} steps={[
	{ id: 'choose', title: 'choose', children: horizontalChoose, completed: readingStage > 0 },
	{ id: 'read', title: 'read', children: horizontalRead, completed: readingStage > 1 },
	{ id: 'note', title: 'keep a note', children: horizontalNote }
]} />
<button type="button" onclick={() => readingStage = (readingStage + 1) % readingStages.length}>
	{readingStage === 2 ? 'start another article' : 'finish this stage'}
</button>

the cards wrap when there is less space. horizontal layout does not supply navigation buttons.

let the form own navigation

  1. name the collection

    Step 1 of 2

svelte
<script lang="ts">
import { Steps, Field, FieldLabel, Input } from '@ciabi/loafkit-ui';
let formStep = $state('name');
let collectionName = $state('');
let nameError = $state('');
</script>

{#snippet nameCollection()}
	<form onsubmit={event => {
		event.preventDefault();
		if (!collectionName.trim()) { nameError = 'give this collection a name first.'; return; }
		nameError = ''; formStep = 'review';
	}}>
		<Field><FieldLabel htmlFor="steps-collection-name">collection name</FieldLabel>
			<Input id="steps-collection-name" bind:value={collectionName} aria-describedby="steps-name-error" aria-invalid={!!nameError} />
		</Field>
		<p id="steps-name-error" role="status">{nameError}</p>
		<button type="submit">review collection</button>
	</form>
{/snippet}
{#snippet reviewCollection()}
	<p>ready to review: {collectionName}</p>
	<button type="button" onclick={() => formStep = 'name'}>edit name</button>
{/snippet}
<Steps variant="focused" bind:currentStep={formStep} steps={[
	{ id: 'name', title: 'name the collection', children: nameCollection, completed: formStep === 'review' },
	{ id: 'review', title: 'review', children: reviewCollection, disabled: !collectionName.trim() }
]} />

disabled does not validate inputs or block app-owned navigation. the submit handler owns this workflow rule; without it, assigning formStep would still open review.

API reference

Steps

Component
steps

the ordered workflow items.

currentStep

the current step ID; rendering falls back to the first item when unset.

variant
Default: 'list'

all instructions, a focused instruction, or horizontal progress.

showStepButtons
Default: false

adds built-in navigation in focused layout.

class
Default: ''

extra classes on the component root.

style

inline styles on the component root.

Step

Type

one step supplied to Steps.

id

unique step ID within the sequence.

title

the visible step name.

children

instructions and app-owned controls for this step.

completed

marks the step complete; does not advance it.

disabled

disables built-in step navigation; does not validate app navigation.