Skip to content

Icon swap

Swaps one icon for another with a short scale and blur.

icon-swap-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Usage

copy-indicator.tsx

Toggle button

Also install Toggle button.

icon-swap-toggle-demo.tsx

Loading state

Any element can be a child, such as a Spinner. Also install Button and Spinner.

icon-swap-loading-demo.tsx

API reference

contentKey: string | numberRequired
Identifies the current icon. A change animates the new icon in and the old icon out.
children: ReactNodeRequired
The icon to show. It is hidden from assistive technology, so label the control that contains it.