Multi-step wizard component for guided workflows.
Features
- Visual progress indicator
- Linear and non-linear navigation
- Step validation
- Customizable steps
- Responsive design
- Keyboard navigation
Examples
<%!-- Basic steps --%>
<.steps current={@current_step}>
<:step id="1" title="Personal Info" description="Basic information">
<:content>
<.input field={@form[:name]} label="Full name" />
<.input field={@form[:email]} label="Email address" />
</:content>
</:step>
<:step id="2" title="Address" description="Contact information">
<:content>
<.input field={@form[:address]} label="Address" />
<.input field={@form[:city]} label="City" />
</:content>
</:step>
<:step id="3" title="Review" description="Confirm your details">
<:content>
<div class="space-y-4">
<p><strong>Name:</strong> <%= @form[:name].value %></p>
<p><strong>Email:</strong> <%= @form[:email].value %></p>
</div>
</:content>
</:step>
</.steps>
<%!-- With navigation --%>
<.steps current={@current_step} on_change="step_changed">
<:step id="1" title="Step 1">...</:step>
<:step id="2" title="Step 2">...</:step>
<:step id="3" title="Step 3">...</:step>
</.steps>LiveView handlers
def handle_event("step_changed", %{"step" => step_id}, socket) do
{:noreply, assign(socket, :current_step, step_id)}
end
Summary
Functions
Attributes
id(:string) (required)current(:string) (required) - Current step ID.on_change(:string) - Event name when step changes. Defaults tonil.orientation(:string) - Defaults to"horizontal". Must be one of"horizontal", or"vertical".class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
step(required) - Accepts attributes:id(:string) (required)title(:string) (required)description(:string)disabled(:boolean)completed(:boolean)