# `LedgerUI.Components.Steps`
[🔗](https://github.com/devaction-labs/ledger_ui/blob/v0.2.0/lib/ledger_ui/components/steps.ex#L1)

Steps: numbered or plain points joined by a line (`steps/1`) and the progress stepper of a
wizard (`stepper/1`). Both draw the canvas `lu-st2`; `stepper variant="classic"` is the old
`lu-steps` bar.

    <.stepper current={2}>
      <:step label="Account" sub="Tax id and address" />
      <:step label="Plan" />
      <:step label="Payment" />
    </.stepper>

    <.steps color="primary" size="sm">
      <:step label="Cart" state="done">1</:step>
      <:step label="Shipping" state="current">2</:step>
    </.steps>

`current` is the 0-based index of the step being worked on: the ones before are `done`, the
ones after `todo`; with `error` the current one is flagged. A step's own `state` wins. The
marker of a step is, in order: its `marker` text, its `icon`, a check when `done` (numbers for
the `xs`/`sm` dots), `!` when `error`, else its number.

Notes:

  * `color` and `size` on `stepper/1` are additions to the README (the canvas previews vary them).
  * Accessibility is rendered server-side: the root is `role="list"`, each step `role="listitem"`;
    the current (or flagged) one has `aria-current="step"` and, on `stepper/1`, every step has
    an `aria-label` with its label and its state name (`state_names`, e.g. "Company, Completed").
    A `:step` takes `style` (animation delays) and any other attribute.
  * The kit CSS classes the README mentions (`steps`, `step-primary`) are replaced by `lu-st2`.

# `stepper`

## Attributes

* `orientation` (`:string`) - Defaults to `"horizontal"`. Must be one of `"horizontal"`, or `"vertical"`.
* `current` (`:integer`) - Defaults to `nil`.
* `error` (`:boolean`) - Defaults to `false`.
* `variant` (`:string`) - Defaults to `"canvas"`. Must be one of `"canvas"`, or `"classic"`.
* `state_names` (`:map`) - Defaults to `%{"current" => "Current", "done" => "Completed", "error" => "Needs attention", "todo" => "Upcoming"}`.
* `color` (`:string`) - Defaults to `nil`.Must be one of `nil`, `"neutral"`, `"primary"`, `"secondary"`, `"accent"`, `"info"`, `"success"`, `"warning"`, or `"error"`.
* `size` (`:string`) - Defaults to `nil`.Must be one of `nil`, `"lg"`, `"md"`, `"sm"`, or `"xs"`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `step` (required) - Accepts attributes:

  * `label` (`:string`)
  * `sub` (`:string`)
  * `state` (`:string`)
  * `marker` (`:string`)
  * `icon` (`:string`)
  * `class` (`:any`)
  * `style` (`:string`)

# `steps`

## Attributes

* `color` (`:string`) - Defaults to `"neutral"`. Must be one of `"neutral"`, `"primary"`, `"secondary"`, `"accent"`, `"info"`, `"success"`, `"warning"`, or `"error"`.
* `orientation` (`:string`) - Defaults to `"horizontal"`. Must be one of `"horizontal"`, or `"vertical"`.
* `size` (`:string`) - Defaults to `"md"`. Must be one of `"xs"`, `"sm"`, `"md"`, or `"lg"`.
* `line_space` (`:boolean`) - Defaults to `false`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `step` (required) - Accepts attributes:

  * `label` (`:string`)
  * `color` (`:string`)
  * `ping` (`:boolean`)
  * `current` (`:boolean`)
  * `state` (`:string`)
  * `class` (`:any`)
  * `style` (`:string`)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
