Steps
Shows where the user is in a flow of steps, such as checkout or onboarding: numbered circles joined by connectors, with a check on each done step. Lay it across or down, or use the progress variant, a Progress bar with "Step 2 of 4", where space is tight. Steps shows the flow; you render the current step's content yourself.
import { Steps } from 'patine-ui';
<VStack gap="lg" style={{ width: 360 }}> <Steps steps={checkout} value={step} onValueChange={setStep} /> <HStack gap="sm"> <Button variant="outline" disabled={step === 0} onPress={() => setStep(step - 1)}>Back</Button> <Button disabled={step === checkout.length} onPress={() => setStep(step + 1)}>Continue</Button> </HStack> </VStack>
Try the props
valuevariantorientation<Steps steps={steps} value={1} />
Example: open a savings account
A bank's sign-up in three steps: Continue checks the step you're on before moving on, a finished step can be pressed to go back to it, and the last one shows the summary.
<Box border radius="lg" padding="lg" gap="lg" style={{ width: '100%', maxWidth: 420 }}> <Steps steps={STEPS} value={step} onValueChange={(i) => i < step && setStep(i)} /> {step === 0 ? ( <TextField label="Full name" value={name} onChangeText={setName} error={tried && !name.trim() ? 'Enter your name as on your ID' : undefined} /> ) : null} {step === 1 ? ( <RadioGroup value={plan} onValueChange={setPlan} aria-label="Account type" options={[ { value: 'flex', label: 'Flex saver · 2.1%', description: 'Take money out any time' }, { value: 'fixed', label: '1-year fixed · 3.4%', description: 'Locked for 12 months' }, ]} /> ) : null} {step === 2 ? ( <VStack gap="xs"> <Text weight="semibold">{name}</Text> <Text color="textSecondary">{plan === 'flex' ? 'Flex saver, 2.1% a year' : '1-year fixed, 3.4% a year'}</Text> </VStack> ) : null} {step === 3 ? <Text weight="semibold">Account opened. Your card arrives in 3 to 5 days.</Text> : null} {step < 3 ? ( <HStack gap="sm"> {step ? <Button variant="outline" onPress={() => setStep(step - 1)}>Back</Button> : null} <Button style={{ flex: 1 }} onPress={next}>{step === 2 ? 'Open account' : 'Continue'}</Button> </HStack> ) : null} </Box>
Down the screen, with descriptions
<Steps orientation="vertical" value={2} style={{ width: 300 }} steps={[ { title: 'Order placed', description: 'Mon, 9:41' }, { title: 'Packed', description: 'Tue, 14:02' }, { title: 'Out for delivery', description: 'Arrives by 18:00' }, { title: 'Delivered' }, ]} />
Progress variant
<Steps variant="progress" value={1} steps={[{ title: 'Account' }, { title: 'Profile' }, { title: 'Done' }]} style={{ width: 300 }} />
Errors
Set error: true on a step to draw it in the danger colour with a !, and read "error" to screen readers.
Accessibility
Each step is named with its place, title and state ("Step 1 of 4: Cart, completed"), and the current step is selected. With onValueChange, done steps are buttons that go back to them. The progress variant is a progressbar named "Step 2 of 4".
Props
| Prop | Type | Default | Description |
|---|---|---|---|
steps | { title, description?, error? }[] | — | |
value | number | — | The current step, from 0. steps.length marks every step done. |
onValueChange | (index: number) => void | — | Makes done steps pressable. |
variant | 'steps' | 'progress' | 'steps' | |
orientation | 'horizontal' | 'vertical' | 'horizontal' | |
labels | Partial<StepsLabels> | English | step (with {page} and {count}), completed, error. |
style | StyleProp<ViewStyle> | — | |
theme / design | provider's | Material fills the current circle; the others ring it. |