Skip to main content

Design system components

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. Markdown version: /design-system/components/icon-swap.md

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

IconSwap props
PropTypeDefaultDescriptionRequired
iconReact.ReactNodenoneGlyph shown at rest, such as copy, play or a sun.Yes
activeIconReact.ReactNodenoneGlyph shown while active is true, such as check, pause or a moon.Yes
activebooleanfalseShows activeIcon instead of icon. Defaults to false.No
classNamestringnoneExtra 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

IconSwap keyboard behaviour
KeyBehaviour
GeneralIconSwap 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.

IconSwap rules
LevelRuleHow it is checked
MUSTARIA: 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.
MUSTARIA: 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.
MUSTRequired stories produce no axe violations at the configured severity.Automated by npm run test:stories:matrix:ci. WCAG 2.5.8.
MUSTThe 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.
MUSTThe component remains legible and operable under a real browser forced-colors: active pass.Automated by npm run test:stories:hc.
MUSTPositional, scale, and opacity motion is suppressed under prefers-reduced-motion.Not yet verified: no evidence record. WCAG 2.2.2, 2.3.3.
MUSTEvery 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.