Stepper
TheStepper component provides a complete solution for multi-step forms and wizards. Features smooth Framer Motion animations, multiple indicator variants, and flexible navigation controls.
Installation
Import
Usage
Components
Stepper (Root)
React.ReactNode
required
The stepper content including steps and navigation.
number
required
Total number of steps in the stepper.
number
default:"0"
Initial active step (0-indexed).
(step: number) => void
Callback fired when the step changes.
string
Additional CSS classes.
Step
React.ReactNode
required
Content for this step.
number
required
Step number (1-indexed).
string
Additional CSS classes.
StepIndicator
'dots' | 'fraction' | 'progress' | 'numbers' | 'text'
default:"'dots'"
Visual style of the step indicator.
string
Additional CSS classes.
StepperNavigation
() => void
required
Callback fired when the last step’s “Finish” button is clicked.
string
Additional CSS classes.
Animation Details
Step Transition
Progress Bar Animation
Indicator Dot Animation
All step transitions use
AnimatePresence with mode="wait" for smooth enter/exit animations.Hook: useStepper
Access stepper state and controls from any child component:Examples
Onboarding Flow
Multi-Step Form with Validation
E-commerce Checkout
Indicator Variants
Dots (Default)
Simple, animated dots indicating progress.Fraction
Displays “Step X of Y” text.Progress
Linear progress bar filling from 0-100%.Numbers
Clickable numbered buttons for each step.Text
Text labels showing “Step 1”, “Step 2”, etc.Best Practices
- Keep steps between 3-7 for optimal user experience
- Provide clear titles and descriptions for each step
- Validate data before allowing navigation to next step
- Show progress clearly with appropriate indicator variant
- Allow users to go back to edit previous steps
- Persist data across steps
- Provide helpful error messages
Accessibility
- Uses semantic
<fieldset>and<legend>elements - Proper ARIA labels for navigation buttons
- Keyboard navigation support
- Screen reader announcements for step changes
- Disabled state for navigation when appropriate