The Doggo.Components.Steps component renders a navigation list for multi-step forms. It supports two primary interaction patterns: using Phoenix.LiveView.JS.patch/1 for URL-based navigation or Phoenix.LiveView.JS.push/2 for sending LiveView events.
Interaction Patterns
1. Patch Navigation (URL-based):
Use this when each step corresponds to a unique URL path.
<.steps current_step={0}>
<:step on_click={JS.patch(to: ~p"/form/step/personal-information")}>
Profile
</:step>
<:step on_click={JS.patch(to: ~p"/form/step/delivery")}>
Delivery
</:step>
<:step on_click={JS.patch(to: ~p"/form/step/confirmation")}>
Confirmation
</:step>
</.steps>
2. Push Events (LiveView-based):
Use this when you want to trigger a specific LiveView event (e.g., go-to-step) with a payload.
<.steps current_step={0}>
<:step on_click={JS.push("go-to-step", value: %{step: "profile"})}>
Profile
</:step>
<:step on_click={JS.push("go-to-step", value: %{step: "delivery"})}>
Delivery
</:step>
<:step on_click={JS.push("go-to-step", value: %{step: "confirmation"})}>
Confirmation
</:step>
</.steps>
<.steps current_step={0}>
<:step on_click={JS.patch(to: ~p"/form/step/personal-information")}>
Profile
</:step>
<:step on_click={JS.patch(to: ~p"/form/step/delivery")}>
Delivery
</:step>
<:step on_click={JS.patch(to: ~p"/form/step/confirmation")}>
Confirmation
</:step>
</.steps>