Stepper
A vertical stepper that renders a list of steps with an optional level of sub-steps. It can act as a progress tracker, where completed steps carry a tick and upcoming steps are muted, or as a static list of steps for explaining a flow.
Installation
npm install @cleartrip/ct-design-stepper
# or
pnpm add @cleartrip/ct-design-stepper
Peer dependencies
# Required for all targets
npm install react
# Web only
npm install react-dom
# React Native only
npm install react-native
Usage
As a progress tracker
activeStep marks the step in focus; every step before workflowStep renders as completed.
import { Stepper } from '@cleartrip/ct-design-stepper';
function Example() {
return (
<Stepper
steps={[{ label: 'Request booking' }, { label: 'Approval' }, { label: 'Book' }]}
activeStep={1}
workflowStep={1}
/>
);
}
As a static list
isStatic renders every step with the same neutral treatment and ignores the progress indices, for cases where the steps explain a flow rather than track one.
<Stepper
isStatic
steps={[
{ label: 'Request booking', subtitle: 'Pick a hotel and raise a request' },
{ label: 'Approval', subtitle: 'Your approver reviews the request' },
{ label: 'Book', subtitle: 'Complete the booking once approved' },
]}
/>
With sub-steps
Sub-steps expand only under the step that is currently active.
<Stepper
steps={[
{ label: 'Traveller details' },
{
label: 'Payment',
hasChildren: true,
subSteps: [{ label: 'Select mode' }, { label: 'Confirm' }],
},
]}
activeStep={1}
workflowStep={1}
activeSubStep={0}
workflowSubStep={0}
/>
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
steps | IStepperStep[] | [] | ✅ Yes | The steps to render, top to bottom. |
activeStep | number | 0 | No | Index of the step in focus. |
activeSubStep | number | 0 | No | Index of the sub-step in focus within the active step. |
workflowStep | number | 0 | No | Steps before this index render as completed. |
workflowSubStep | number | 0 | No | Sub-steps before this index render as completed. |
isStatic | boolean | false | No | Renders every step neutral and ignores the progress indices. |
styleConfig | IStepperStyleConfig | {} | No | Style overrides for the root, rows, icons, labels and vertical line. |
IStepperStep
| Field | Type | Required | Description |
|---|---|---|---|
label | string | ✅ Yes | The step label. |
subtitle | string | No | Secondary line rendered under the label. |
hasChildren | boolean | No | Whether the step expands into sub-steps when active. |
subSteps | IStepperSubStep[] | No | The sub-steps, rendered only while the step is active. |
onClick | () => void | No | Fired when the step's icon or label is pressed. |
StepStatus
DONE— completed: solid green circle with a tickCURRENT— in focus: outlined circle with an emphasised labelPENDING— upcoming: muted circle and labelNEUTRAL— no progress relationship, used byisStatic
StepLevel
OUTER— a top-level stepINNER— a sub-step
Accessibility
- The component follows accessibility best practices
- Ensure proper ARIA attributes are provided where needed
- Test with screen readers to ensure usability