Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

useStep

Zero-based step state for wizards and multi-page forms.

HooksState@gaudi/design-system/hooks/state/use-stepView in StorybookSource

The current step with next, previous, goTo and reset, clamped to the step count, controlled or uncontrolled. Pairs with Stepper and Progress.

Usage

import { useStep } from '@gaudi/design-system/hooks';
const { step, next, previous, canGoNext, canGoPrevious } = useStep({ count: 4 });

Examples

Wizard with progress

Storybook

API

3 options
3 return values

Accessibility

Move focus to the new step heading after Next or Back, and state the position in text ("Step 2 of 4").

Notes

  • Validate the current step before calling next; the hook does not know your rules.