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.
-
collect articles
save the articles you want to share.
Completed
-
review links
open each link before sending the collection.
-
share collection
sharing opens after the review.
Unavailable
usage
<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)
- steps
choose a focused step
-
collect
keep one useful article for the weekend.
-
review
check the saved links, then share the collection.
Unavailable
current step: collect
<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
-
choose
pick an article you have time for.
-
read
read it without opening another tab.
-
keep a note
keep one detail you want to remember.
<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
-
name the collection
Step 1 of 2 -
review
Step 2 of 2ready to review:
Unavailable
<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
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:
falseadds built-in navigation in focused layout.
class- Default:
''extra classes on the component root.
style-
inline styles on the component root.
Step
one step supplied to Steps.