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

# mds-stepper-bar-item

> `@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-item>` web component represents a single step inside a [`<mds-stepper-bar>`](../mds-stepper-bar/AGENTS.md) progress indicator, rendering the step's icon, optional ordinal label, descriptive text and status badge. It has no standalone meaning: it is the unit the parent stepper orchestrates to express a sequential, multi-step flow.

#### Semantic Behavior

- **Compound child only**: Must be placed as a direct default-slot child of `<mds-stepper-bar>`; it is not used standalone or mixed with other child types in that slot.
- **State driven by the parent**: The `done` and `current` props are not set per item by the consumer - the parent's `itemsDone` prop drives `done`/`current` on each child, so an item's visual state is a function of its position relative to the active step.
- **Index resolution**: The item computes its own ordinal from its position among the parent's children; this index feeds the localized "step N" caption rendered when `step` is enabled ("Step 2" in English, "Passo 2" in Italian), or the `{{ index }}` of the caption the page writes in `step-label`.
- **Three-way status badge**: When `badge` is true the item renders a status badge whose variant and localized text reflect the resolved state - `success`/done, `info`/current, or `dark`/queued.
- **Icon swap on completion**: The displayed icon switches from `icon` to `iconChecked` once the item is done and no longer current.
- **Going back**: A step that is done (and not current) is a button in the tab order: a click or Enter emits `mdsStepperBarItemDone` with its `{ value }`. It asks, it does not move: the page goes back by setting `itemsDone` on the bar. The current and the following steps are not interactive.
- **Localization**: Step, badge and status strings are localized (el/en/es/it); `step-label` replaces the step caption in any other language.

#### Properties & Visual Configurations

Most state props are managed by the parent rather than the consumer. The props worth configuring directly on each item are:

- **`icon` / `iconChecked`**: Set `icon` for the default and current appearance; set `iconChecked` only when the completed step should show a different glyph (it defaults to `icon`).
- **`step`**: Enable to surface the auto-numbered "step N" caption above the label - use it for explicitly ordered flows where the number aids orientation.
- **`step-label`**: The text of that caption, when the page needs another word or a language the component has no texts for: `{{ index }}` in it becomes the position of the step (`step-label="Fase {{ index }}"` gives "Fase 1", "Fase 2"), a text without it is shown as it is. `step` still decides whether the caption is shown.
- **`badge`**: Enable to show the queued/current/done status pill; prefer it when status legibility matters more than horizontal compactness.
- **`value`**: The token the parent collects from the completed items into the `value` of its `mdsStepperBarChange` detail (comma-joined); set it so the parent can aggregate which steps have been completed.
- **`typography`**: Overrides the label's typography token (defaults to `h6`); lower it for denser bars.

## 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-stepper-bar-item--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 |
| --- | --- | --- | --- | --- |
| `badge` | `badge` | `boolean` | - | Specifies if the badge status is displayed |
| `current` | `current` | `boolean` | `false` | Specifies if the component is the current or not |
| `done` | `done` | `boolean` | `false` | Specifies if the component is checked or not |
| `icon` | `icon` | `string` | - | **Required**. Specifies the icon displayed of the component when is not checked or the current item |
| `iconChecked` | `icon-checked` | `string \| undefined` | `this.icon` | Specifies the icon displayed of the component when is checked |
| `label` | `label` | `string` | - | **Required**. Specifies a short description of the component |
| `step` | `step` | `boolean` | - | Shows the caption of the step above the label: "Step 1", "Passo 1", in the language of the page, or the text of `stepLabel` |
| `stepLabel` | `step-label` | `string \| undefined` | - | The text of the caption that `step` shows, in place of the one the component writes in the language of the page ("Passo 2"). `{{ index }}` in it becomes the position of the step, as in the phrases of the component: `"Fase {{ index }}"` gives "Fase 1", "Fase 2"; a text without it is shown as it is. For another word, or a language the component has no texts for |
| `typography` | `typography` | `"action" \| "caption" \| "detail" \| "h1" \| "h2" \| "h3" \| "h4" \| "h5" \| "h6" \| "hack" \| "label" \| "option" \| "paragraph" \| "snippet" \| "tip" \| undefined` | `'h6'` | Specifies the typography of the element |
| `value` | `value` | `string \| undefined` | - | Specifies the value of the step: once the step is done, mds-stepper-bar adds it to the `value` of `mdsStepperBarChange`, which joins the values of the done steps with commas |

## Events

| Event | Detail | Description |
| --- | --- | --- |
| `mdsStepperBarItemDone` | `MdsStepperBarItemEventDetail` | Emits when the user activates a step that is done, to go back to it: the page moves the stepper bar there through `itemsDone` |

## Parts

| Part | Description |
| --- | --- |
| `badge` | The badge wrapper |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-stepper-bar-item-color` | Sets the color of the text |
| `--mds-stepper-bar-item-min-width` | Sets the minimum width of the component; the last item, which has no bar, takes the width of its texts instead |

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

## Dependencies

Uses: `mds-badge`, `mds-icon`, `mds-progress`, `mds-text`.
