# IconSwap

> Two glyphs in one cell that crossfade with scale and blur when a state flips, such as copy to check, play to pause or sun to moon.

- Status: alpha
- Group: display
- Page: https://www.digitaltableteur.com/design-system/components/icon-swap
- Contract: https://www.digitaltableteur.com/contracts/v1/IconSwap.contract.json

## When to use

Two glyphs in one cell that crossfade with scale and blur when a state flips, such as copy to check, play to pause or sun to moon.

## When not to use

The contract records no forbidden uses.

## Look-alikes

The contract names no look-alike with a deciding condition.

## Props

| Prop | Type | Default | Description | Required |
| --- | --- | --- | --- | --- |
| `icon` | `React.ReactNode` | none | Glyph shown at rest, such as copy, play or a sun. | Yes |
| `activeIcon` | `React.ReactNode` | none | Glyph shown while `active` is true, such as check, pause or a moon. | Yes |
| `active` | `boolean` | `false` | Shows `activeIcon` instead of `icon`. Defaults to `false`. | No |
| `className` | `string` | none | Extra class names on the root. | No |

## Variants

No variant dimensions and no props with a fixed set of values.

## Invalid combinations

The contract records no invalid combinations.

## Keyboard

| Key | Behaviour |
| --- | --- |
| General | IconSwap has no tab stop; the button or link around it takes focus. |

## Rules

Every item under When not to use is a MUST NOT. MUST and SHOULD follow RFC 2119.

| Level | Rule | How it is checked |
| --- | --- | --- |
| MUST | ARIA: Both glyphs are aria-hidden: the surrounding control carries the accessible name and announces the state (aria-pressed, or a live message such as Copied). | Not yet verified: no evidence record. WCAG 4.1.2. |
| MUST | ARIA: The swap never empties the control: the outgoing and incoming glyphs overlap in one grid cell. | Not yet verified: no evidence record. WCAG 4.1.2. |
| MUST | Required stories produce no axe violations at the configured severity. | Automated by `npm run test:stories:matrix:ci`. WCAG 2.5.8. |
| MUST | The accessibility tree (role, name, state) matches the committed snapshot for every required story. | Automated by `npm run test:stories:matrix:ci`. WCAG 1.3.1, 4.1.2. |
| MUST | The component remains legible and operable under a real browser forced-colors: active pass. | Automated by `npm run test:stories:hc`. |
| MUST | Positional, scale, and opacity motion is suppressed under prefers-reduced-motion. | Not yet verified: no evidence record. WCAG 2.2.2, 2.3.3. |
| MUST | Every documented keyboard interaction works as specified. | Not yet verified: no evidence record. WCAG 2.1.1, 2.1.2. |

## Install and import

- In-repo only. IconSwap is not exported from `@digitaltableteur/react`, so there is no public import path.
- Alpha components are internal and never exported.

## Links

- Machine-readable contract (Design System Contract 1.0): https://www.digitaltableteur.com/contracts/v1/IconSwap.contract.json
- Markdown version of this page: https://www.digitaltableteur.com/design-system/components/icon-swap.md
- Component index as JSON: https://www.digitaltableteur.com/design-system/components.json
- All components: https://www.digitaltableteur.com/design-system/components
- Source: The implementation lives in a private repository. This page, its Markdown twin and the contract are generated from it at build time and are the public source of truth.
