import IconArrowLeft from 'lucide-svelte/icons/arrow-left';
import IconArrowRight from 'lucide-svelte/icons/arrow-right';
{ label: 'Step 1', description: 'The description of step 1.' },
{ label: 'Step 2', description: 'The description of step 2.' },
{ label: 'Step 3', description: 'The description of step 3.' },
{ label: 'Step 4', description: 'The description of step 4.' },
{ label: 'Step 5', description: 'The description of step 5.' }
let currentStep = $state(0);
const isFirstStep = $derived(currentStep === 0);
const isLastStep = $derived(currentStep === steps.length - 1);
/** Determine if on the current step. */
function isCurrentStep(index: number) {
return currentStep === index;
/** Jump to a particular step. */
function setStep(index: number) {
/** Progress to the previous step. */
/** Progress to the next step. */
<div class="flex justify-between items-center gap-4">
class="btn-icon btn-icon-sm rounded-full {isCurrentStep(i) ? 'preset-filled-primary-500' : 'preset-filled-surface-200-800'}"
onclick={() => setStep(i)}
<span class="font-bold">{i + 1}</span>
<hr class="hr !border-surface-200-800 absolute top-[50%] left-0 right-0 z-[-1]" />
{#each steps as step, i (step)}
<!-- Filter to current step only -->
<!-- Individual steps -->
<div class="card bg-surface-100-900 p-10 space-y-2 text-center">
<h2 class="h3">{step.label}</h2>
<p>{step.description}</p>
<nav class="flex justify-between items-center gap-4">
<button type="button" class="btn preset-tonal hover:preset-filled" onclick={prevStep} disabled={isFirstStep}>
<IconArrowLeft size={18} />
<button type="button" class="btn preset-tonal hover:preset-filled" onclick={nextStep} disabled={isLastStep}>
<IconArrowRight size={18} />