Stepper

The steps of a process, marking the done ones and the current one.

Import

ts
import { Stepper } from '@k8ordo/ui';

Usage

value is the index of the current step (0-based). Done steps show a check and are read as completed; the current step carries aria-current="step".

  1. PlanPick what fitscompleted
  2. PaymentCard or invoice
  3. ReviewCheck and send
tsx
const steps = [
  { label: 'Plan', description: 'Pick what fits' },
  { label: 'Payment', description: 'Card or invoice' },
  { label: 'Review', description: 'Check and send' },
];

<Stepper aria-label="Sign-up" steps={steps} value={1} />

Going back to a done step

With interactive, done steps become buttons and onChange receives the index of the one pressed. Steps ahead cannot be jumped to.

  1. ReviewCheck and send
tsx
const [step, setStep] = useState(2);

<Stepper
  aria-label="Sign-up"
  interactive
  onChange={setStep}
  steps={steps}
  value={step}
/>

Vertical

  1. PlanPick what fitscompleted
  2. PaymentCard or invoice
  3. ReviewCheck and send
tsx
<Stepper
  aria-label="Sign-up"
  orientation="vertical"
  steps={steps}
  value={1}
/>

Props

steps
Type: readonly StepperStep[]
Default: -
defaultValue?
Type: number
Default: -
interactive?
Type: boolean
Default: false
onChange?
Type: (value: number) => void
Default: -
orientation?
Type: 'horizontal'|'vertical'
Default: 'horizontal'
ref?
Type: Ref<HTMLOListElement>
Default: -
value?
Type: number
Default: -

Type base (some attrs are managed internally): OlHTMLAttributes<HTMLOListElement>

Wording this component renders (labels, placeholders, and the like) comes from the message dictionary when no prop sets it. To change it, see: i18n