Import this in your client-side component
MyComponent.tsx
import { useStep } from "react-amazing-hooks";
Api | Description | Type | Return Type | Example |
---|---|---|---|---|
step | Current step value. | number | number | 1 |
maxStep | Maximum allowed step (if set). | number | undefined | number | undefined | 10 |
minStep | Minimum allowed step. | number | number | 0 |
next | Move to the next step, clamped at maxStep . | () => void | void | next() |
prev | Move to the previous step, clamped at minStep . | () => void | void | prev() |
reset | Reset step to initial value (clamped within limits). | () => void | void | reset() |
set | Set step to a specific value, clamped within limits. | (value: number) => void | void | set(2) |
canGoNext | Boolean indicating if next step is available. | boolean | boolean | Note* |
canGoPrev | Boolean indicating if previous step is available. | boolean | boolean | Note* |
Check the UseStepOptions
interface in the 'Types' tab.
Check the 'Example' tab above the table for an exhaustive example. *