Utils
Pure utility functions for working with steps
The Utils
object provides a set of pure functions for working with steps. These functions help you query and traverse step collections without modifying state or requiring stepper context.
Functions
Function | Description | Parameters | Returns |
---|---|---|---|
getAll | Retrieves all steps in the stepper. | None | An array of all steps |
get | Retrieves a step by its ID. | id : The ID of the step to retrieve | The step with the specified ID |
getIndex | Retrieves the index of a step by its ID. | id : The ID of the step to retrieve the index for | The index of the step |
getByIndex | Retrieves a step by its index. | index : The index of the step to retrieve | The step at the specified index |
getFirst | Retrieves the first step in the stepper. | None | The first step |
getLast | Retrieves the last step in the stepper. | None | The last step |
getNext | Retrieves the next step after the specified ID. | id : The ID of the current step | The next step |
getPrev | Retrieves the previous step before the specified ID. | id : The ID of the current step | The previous step |
getNeighbors | Retrieves the neighboring steps (previous and next) of the specified step. | id : The ID of the current step | An object containing the previous and next steps, or null if they do not exist |
Usage Example
Here's a quick example of how you might use the Utils
object in a React component:
Edit on GitHub
Last updated on