Skip to content

Stepper

Download .md

A stepper shows the steps of a flow, which ones are done, and the one people are on, such as applying for a clearance.

  • Use it for flows of 3 to 6 steps that people go through in order.
  • Name each step with a short noun: “Data rilis”, “Dokumen”.
  • Save a draft at every step, so people can stop and come back: “Simpan dulu, lanjutkan kapan saja.”
  • Use one page with sections instead when the form is short.
React
  1. selesaiPilih lagu
  2. 2Data rilis
  3. 3Dokumen
  4. 4Kirim

Langkah 2 dari 4

Vue
  1. selesaiPilih lagu
  2. 2Data rilis
  3. 3Dokumen
  4. 4Kirim
Step 2 of 0

Langkah 2 dari 4

1234
  1. 1Done step
  2. 2Current step
  3. 3Upcoming step
  4. 4Connector

An ordered list of steps. Each step is a 32px circle and its name below it, joined to the next step by a 1px line.

State Circle Line to the next step
Completed primary-soft with a check, in primary-text primary
Current primary with the number, in primary-foreground border
Next muted with the number, in muted-foreground border

Below sm only the current step’s name shows, with a line such as “Langkah 2 dari 4” under the stepper; screen readers still hear every name.

There is one style, horizontal.

React Vue Flutter Type Default Use
value v-model built from Row (no stepper in shadcn_ui) number none (React), 1 (Vue) The current step, from 1.
completedText completed-text Semantics label text completed Read after each completed step, such as “selesai”.
StepperItem step StepperItem :step the index number none The step’s number.
StepperTitle, StepperDescription same Text text none The step’s name and an optional line.
import { useState } from "react"
import { Button } from "@/components/ui/button"
import { Stepper, StepperIndicator, StepperItem, StepperSeparator, StepperTitle } from "@/components/ui/stepper"
const steps = ["Pilih lagu", "Data rilis", "Dokumen", "Kirim"]
export default function StepperDemo() {
const [step, setStep] = useState(2)
return (
<div className="grid w-full max-w-xl gap-6">
<Stepper value={step} completedText="selesai" aria-label="Ajukan clearance">
{steps.map((title, index) => (
<StepperItem key={title} step={index + 1}>
<StepperIndicator />
<StepperTitle>{title}</StepperTitle>
{index < steps.length - 1 && <StepperSeparator />}
</StepperItem>
))}
</Stepper>
<p className="text-center text-sm text-muted-foreground sm:hidden">
Langkah {step} dari {steps.length}
</p>
<div className="flex justify-between">
<Button variant="outline" disabled={step === 1} onClick={() => setStep((s) => s - 1)}>
Kembali
</Button>
<Button disabled={step === steps.length} onClick={() => setStep((s) => s + 1)}>
Lanjut
</Button>
</div>
</div>
)
}
Terminal window
npx shadcn@latest add https://design.sosialoka.tech/r/react/stepper.json
  • It is an ordered list; the current step has aria-current="step".
  • Completed steps say so to screen readers, such as “selesai”.
  • Give the list a name with aria-label, such as “Ajukan clearance”.
  • The circles and lines are decoration; the names carry the meaning.