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

# mds-pref-animation

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

The `<mds-pref-animation>` web component is a preference control that lets users choose how animations are presented (reduced, system-driven, or fully enabled). It is usually a child of [`<mds-pref>`](../mds-pref/AGENTS.md) and renders a labelled three-option tab group rather than any native HTML primitive.

#### Semantic Behavior

- **Usually inside `<mds-pref>`**: Placed as a direct default-slot child of `<mds-pref>`, which groups the preference controls in one panel; it also works on its own, since it applies and stores the preference by itself.
- **Tab-group selection**: Renders three options (reduce / system / no-preference); the active one is driven by the `mode` value, and clicking an option sets that mode.
- **Applies the preference globally**: Choosing a mode applies it across the whole document and persists the choice, so it is restored on later visits.
- **Initial mode resolution**: The effective mode is resolved in order from the `mode` prop, then the persisted value, then the `system` default.
- **Change event**: `mdsPrefChange` (detail `{ preference: 'animation' }`) fires once per change, after the new mode is applied; a pick of the mode already active and the first application on load do not emit it. It bubbles up to `<mds-pref>`; an animation change needs no reload, so it raises no reload notice.
- **Instances stay in sync**: Instances mounted together (a hidden `<mds-pref controller>` and a visible settings panel) share the applied animation: a pick in one is mirrored by the others, which neither apply it again nor emit `mdsPrefChange`. A `pref-animation-*` class written on `<html>` by other code is mirrored the same way.

#### Properties & Visual Configurations

- **`mode`**: Sets which animation preference is active - `reduce` to suppress motion, `no-preference` to fully enable animations, or `system` to defer to the user's OS setting. Leave unset to fall back to the persisted or default (`system`) value.
- **`size`**: Sizes the nested tab items (`sm` or `md`). Inside `<mds-pref>`, set it on the parent instead: the parent's `size` reaches every `mds-pref-*` child on load and when it changes, and overwrites the child's own.

## 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-preferences-animation--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 |
| --- | --- | --- | --- | --- |
| `mode` | `mode` | `"no-preference" \| "reduce" \| "system" \| undefined` | - | Specifies the preference mode |
| `size` | `size` | `"md" \| "sm" \| undefined` | - | Sets the size of the component items nested inside it |

## Events

| Event | Detail | Description |
| --- | --- | --- |
| `mdsPrefChange` | `MdsPrefChangeEventDetail` | Emits when the component is triggered |

## Dependencies

Uses: `mds-text`, `mds-tab`, `mds-tab-item`.
