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

# mds-accordion-timer

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

The `<mds-accordion-timer>` web component is the orchestrating parent of an auto-advancing accordion in the Magma Design System. It groups one or more `<mds-accordion-timer-item>` children, runs a timed progress cycle over them, and automatically opens the next item when the current one elapses - a behaviour with no native HTML primitive.

#### Semantic Behavior

- **Compound parent**: Drives selection across its slotted `<mds-accordion-timer-item>` children; it is meaningless without item children.
- **Initial selection**: The child carrying `selected` (the last one, if several do) becomes the active item and starts the timer on load; if none is selected, the timer stays idle until an item is activated.
- **Auto-advance cycle**: When the active item elapses, the next item opens, wrapping back to the first after the last - producing a continuous loop.
- **Per-item duration override**: Each item uses its own `duration` when set, otherwise falling back to the parent `duration`.
- **Pause on hover**: Hovering the active item pauses the countdown and resumes on mouse-leave; this is suppressed while `paused` is set.
- **Manual selection**: Clicking an item selects it and holds its countdown at the start until the pointer leaves the item, while programmatic selection restarts the timer from the beginning of that item. Both clear `paused`.
- **Emitted event**: `mdsAccordionTimerChange` with the new item `index` whenever the active item changes, once for a click and once for an auto-advance.

#### Properties & Visual Configurations

This component exposes only timing controls; it has no `variant` / `tone` / `size` ladder of its own.

#### Other behavioral props

- **`duration`** is the fallback cycle length in milliseconds applied to every item that does not declare its own `duration`; it is the global pacing knob for the whole accordion.
- **`paused`** freezes the countdown at its current remaining time when set and resumes it when cleared. While paused, hover-driven pause/resume is disabled; selecting an item, by click or from code, clears it.

## 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-accordion-timer--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 |
| --- | --- | --- | --- | --- |
| `duration` | `duration` | `number` | `10000` | Sets the duration of the single accordion item |
| `paused` | `paused` | `boolean \| undefined` | - | When paused is defined, the timer stops run |

## Events

| Event | Detail | Description |
| --- | --- | --- |
| `mdsAccordionTimerChange` | `MdsAccordionTimerEventDetail` | Emits when the accordion changes it's item |

## Slots

| Slot | Description |
| --- | --- |
| (default) | Add `mds-accordion-timer-item` element/s. |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-accordion-timer-color` | Sets the text color of the component mds-accordion-timer-item |

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