Word swap

Words that take turns in one place: the new one drops in out of a blur as the old one sinks away. Pure CSS transitions.

I build springs

Features

  • Every word sits in the same grid cell, so the slot is as wide as the widest word and the line never jumps.
  • The swap is CSS transitions on a data-state: no animation library, nothing per frame.
  • Controlled with index, or cycling on its own with every.

Use it for

  • Roles or titles under a name.
  • Rotating taglines, status words.

On this site

Installation

  1. Get runets.
    git clone https://github.com/ziyam-khan/runets
  2. Copy these files into your project, keeping their folders.
  3. Install what they use.
    pnpm add react
  4. Load the styles once. Bring your own base tokens, or use runets’ default theme.
    import 'runets/styles/theme.css'
    import 'runets/styles/kit.css'

API

PropTypeWhat it does
wordsstring[]The words, in order.
indexnumberWhich word shows; wraps, so a running counter works.
everynumberMilliseconds per word when index is not given.

Accessibility

Source

The code is in src/kit/word-swap.tsx in runets, MIT licensed.