Stepper
The steps of a process in order, marking the completed ones and the current one. Use it to show progress through a multi-step form.
Import
Copy code
import { Stepper } from '@k8ordo/ui';Usage
value is the index of the current step, counted from 0. Completed steps show a check and are read as completed. The current step carries aria-current="step".
- PlanPick what fitscompleted
- PaymentCard or invoice
- ReviewCheck and send
Copy code
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 completed step
With interactive, completed steps become buttons. Pressing one hands its index to onChange. Steps ahead cannot be jumped to.
- ReviewCheck and send
Copy code
const [step, setStep] = useState(2);
<Stepper
aria-label="Sign-up"
interactive
onChange={setStep}
steps={steps}
value={step}
/>Vertical
- PlanPick what fitscompleted
- PaymentCard or invoice
- ReviewCheck and send
Copy code
<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: -
| Prop | Type | Default |
|---|---|---|
steps | readonly StepperStep[] | - |
defaultValue? | number | - |
interactive? | boolean | false |
onChange? | (value: number) => void | - |
orientation? | 'horizontal'|'vertical' | 'horizontal' |
ref? | Ref<HTMLOListElement> | - |
value? | number | - |
Inherited attributes (except the ones set internally): OlHTMLAttributes<HTMLOListElement>
The wording this component draws (labels, placeholders, and so on) comes from the message dictionary unless a prop sets it. To replace it, see: i18n