Navigating steps | laravel-livewire-wizard | Spatie

 SPATIE

  Laravel Livewire Wizard
==========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-livewire-wizard](https://spatie.be/docs/laravel-livewire-wizard/v2)  Usage  Navigating steps

 Version   v2   v1

 Other versions for crawler [v2](https://spatie.be/docs/laravel-livewire-wizard/v2) [v1](https://spatie.be/docs/laravel-livewire-wizard/v1)

  Navigating steps
- [ Introduction ](https://spatie.be/docs/laravel-livewire-wizard/v2/introduction)
- [ Support us ](https://spatie.be/docs/laravel-livewire-wizard/v2/support-us)
- [ Requirements ](https://spatie.be/docs/laravel-livewire-wizard/v2/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-livewire-wizard/v2/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-livewire-wizard/v2/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-livewire-wizard/v2/changelog)
- [ About us ](https://spatie.be/docs/laravel-livewire-wizard/v2/about-us)

Usage
-----

- [ Creating your first wizard ](https://spatie.be/docs/laravel-livewire-wizard/v2/usage/creating-your-first-wizard)
- [ Navigating steps ](https://spatie.be/docs/laravel-livewire-wizard/v2/usage/navigating-steps)
- [ Rendering navigation ](https://spatie.be/docs/laravel-livewire-wizard/v2/usage/rendering-navigation)
- [ Accessing state ](https://spatie.be/docs/laravel-livewire-wizard/v2/usage/accessing-state)
- [ Setting initial state ](https://spatie.be/docs/laravel-livewire-wizard/v2/usage/setting-initial-state)
- [ Testing wizards ](https://spatie.be/docs/laravel-livewire-wizard/v2/usage/testing-wizards)

 Navigating steps
================

###  On this page

1. [ Navigating to the next step ](#content-navigating-to-the-next-step)
2. [ Navigating to the previous step ](#content-navigating-to-the-previous-step)
3. [ Showing any step ](#content-showing-any-step)
4. [ Start at a specific step ](#content-start-at-a-specific-step)

There are various methods to navigate from one step to another. When switching steps we'll take care to preserve and restore state.

Navigating to the next step
-----------------------------------------------------------------------------------------------------------------------------------------

You can navigate to the next step, using `nextStep`. You can call that method anywhere in your step component.

```
// somewhere in your step component

$this->nextStep();
```

You can also call it in your view.

```

    Go to the next step

```

Navigating to the previous step
-----------------------------------------------------------------------------------------------------------------------------------------------------

You can navigate to the previous step, using `previousStep`. You can call that method anywhere in your step component.

```
// somewhere in your step component

$this->previousStep();
```

You can also call it in your view.

```

    Go to the previous step

```

Showing any step
--------------------------------------------------------------------------------------------------------

To show any step, call `showStep` and pass it the component name of the step you want to show.

```
// somewhere in your step component

$this->showStep('confirm-order-step');
```

You can also call it in your view.

```

    Go to the confirm order step

```

You can also check if a next or previous step exists directly from the step component.

```
$this->hasNextStep();
$this->hasPreviousStep();
```

Start at a specific step
--------------------------------------------------------------------------------------------------------------------------------

If you want the wizard to display a specific step when it is rendered first, you can pass the step name to the `show-step` property.

```

```

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
