<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-stepper-bar/ in the magma monorepo (usage/*.md and the
  component's JSDoc). Regenerated on every stencil build (scripts/component-docs.ts).
-->

# mds-stepper-bar

> `@maggioli-design-system/magma` 2.15.0. Shadow DOM: style it only through the public CSS custom properties and the parts below.

The `<mds-stepper-bar>` web component is the Magma Design System container that orchestrates a multi-step progress flow, coordinating a set of slotted `<mds-stepper-bar-item>` children and revealing the matching content panel for the active step. It has no native HTML equivalent; it composes a stepper indicator track with a switchable content region.

#### Semantic Behavior

- **Compound parent**: It is the controlling parent of `<mds-stepper-bar-item>` children placed in the default slot, driving every child's `done`/`current` state - children do not manage their own progression.
- **Active step derivation**: From `itemsDone` it marks all earlier items as `done`, the item at the current index as `current`, and clears the rest; the active step is `itemsDone - 1`.
- **Content synchronization**: Each `slot="content"` element is paired by position to a stepper item; only the panel matching the current index is shown. The other panels get the `hidden` attribute, so no style of the page is needed (a `display` the page sets on a panel overrides it). The panels are the direct children with `slot="content"`, read again at every step and whenever the slot changes: a panel that a framework renders, replaces or removes after the load (conditional rendering, a keyed list) takes the state of its step at once.
- **Child requests, page decides**: A step that is done emits `mdsStepperBarItemDone` when the user activates it; the bar does not move by itself, progress is driven by `itemsDone` only. To let the user go back, listen for the event and set `itemsDone` to the index of that item plus one.
- **Auto-scroll**: When a step becomes current the indicator track scrolls horizontally to center the active item.
- **Change event**: It emits `mdsStepperBarChange` when it loads and whenever `itemsDone` changes, with a detail of the active `step` index and a comma-joined `value` string collected from the completed items.

#### Properties & Visual Configurations

- **`itemsDone`** is the controlled entry point for progress: `0` means no step completed, `1` activates the first step, and `last + 1` marks the whole flow complete. Treat it as the single source of truth for which step is current rather than mutating children directly.

#### Other behavioral props

- **`navigation`** selects how the indicator track is traversed: `'none'` (default) keeps the track static, while `'scrollbar'` exposes a horizontal scrollbar (styleable through the `--mds-stepper-bar-scrollbar-*` custom properties) for flows with many steps.

## Read next

- [`examples.md`](examples.md) - correct usage, from the most common case
- [`mistakes.md`](mistakes.md) - the wrong forms, each with the right one
- [Storybook](https://magma-design-system.github.io/magma/storybook/?path=/docs/ui-stepper-bar--docs) - the live examples, in the published Storybook of `main`
- [`conventions.md`](../../../../agents/conventions.md), [`variants.md`](../../../../agents/variants.md), [`mistakes.md`](../../../../agents/mistakes.md) - the rules shared by every component

## Props

| Prop | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `itemsDone` | `items-done` | `number` | `1` | Sets the current item by its position, counted from 1: the items before it are done. 1 makes the first item current with none done, 0 makes no item current, the number of items + 1 marks them all done |
| `navigation` | `navigation` | `"none" \| "scrollbar"` | `'none'` | Specifies the navigation type |

## Events

| Event | Detail | Description |
| --- | --- | --- |
| `mdsStepperBarChange` | `MdsStepperBarEventDetail` | Emits when a step is changed |

## Slots

| Slot | Description |
| --- | --- |
| (default) | Add `mds-stepper-bar-item` element/s. |
| `content` | Add `HTML elements` or `components`, one per mds-stepper-bar-item added |

## Parts

| Part | Description |
| --- | --- |
| `contents` | Selects the `contents` container element wrapped in shadowDOM. |
| `items` | Selects the `items` container element wrapped in shadowDOM. |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-stepper-bar-gap` | Sets the gap between the stepper bar items. |
| `--mds-stepper-bar-offset-margin` | Sets the offset margin of the stepper bar. |

Only these are public. Its other 6 are internal: they may change in any release, do not set them.
