Skip to content

Text swap

Animates text when its value changes.

Gather

text-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.

Button label

Set a minimum width so the button keeps its size.

text-swap-button-demo.tsx

API reference

value: stringRequired
The text to show. A change animates. The first value shows without animation. Where text cannot wrap, such as in a button, a long value truncates.