Components Data display

Animated Text Rotator

Cycle through words or short phrases in a headline. Try ten different transitions with the same text.

Live previewGo + JavaScript
Hello,

Usage

Pass an ordered list of strings in Words. The first phrase appears in the server-rendered HTML. Place the default inline rotator inside a heading or sentence, or set ShowControls to true for an interactive preview with an effect picker and a playback button. Set Paused to true to start with the first phrase held in place.

Register animated-text-rotator with Head and pass its properties to Render. Go setup guide

Interval sets how long each phrase stays still, from 250 to 60,000 milliseconds (default 2,000). Duration sets the transition time, from 0 to 3,000 milliseconds (default 650). Set Duration to 0 for an instant change.

Effect accepts blur (default), fade, mask-reveal, slide, zoom, flip-3d, drop-bounce, wave, typewriter, or scramble.

Go usage
Go usage
err := mono.UI.Render(w, "animated-text-rotator", mono.Props{
	"Duration":     650,
	"Effect":       "blur",
	"Interval":     2000,
	"ShowControls": true,
	"Words": []any{
		"Hello,",
		"Welcome.",
		"Stay curious.",
		"Make things.",
	},
})
Rendered HTML
Rendered HTML
<span id="demo-animated-text-rotator" data-mono="animated-text-rotator" class="mu-rot mu-rot-player"
  data-effect="blur"
  data-interval="2000"
  data-duration="650"
  >
  <span class="mu-rot-picker" data-rot-picker role="group" aria-label="Animation effect" hidden>
    <span class="mu-rot-caption" aria-hidden="true">Effect</span>
    <span class="mu-rot-options" data-rot-options></span>
    <select class="mu-rot-select" data-rot-select aria-label="Animation effect"></select>
  </span>
  <span class="mu-rot-stage">
    <span class="mu-rot-type">
      <span class="mu-rot-measure" data-rot-word dir="auto" aria-hidden="true">Hello,</span><span class="mu-rot-measure" data-rot-word dir="auto" aria-hidden="true">Welcome.</span><span class="mu-rot-measure" data-rot-word dir="auto" aria-hidden="true">Stay curious.</span><span class="mu-rot-measure" data-rot-word dir="auto" aria-hidden="true">Make things.</span>
      <span class="mu-rot-layer" data-rot-layer dir="auto" aria-hidden="true">Hello,</span>
      <span class="mu-sr-only" data-rot-reading>Hello,</span>
    </span>
    <span class="mu-rot-transport" data-rot-transport hidden>
      <span class="mu-rot-position" aria-hidden="true"><span class="mu-rot-caption">Phrase</span> <b data-rot-index>01</b> / <span data-rot-total></span></span>
      <span class="mu-rot-actions" role="group" aria-label="Phrase playback">
        <button type="button" data-rot-prev aria-label="Previous phrase" title="Previous phrase"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5m6-6-6 6 6 6"/></svg></button>
        <button type="button" data-rot-play><svg width="12" height="12" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path class="mu-rot-pause-icon" d="M3 2h3v12H3zm7 0h3v12h-3z"/><path class="mu-rot-play-icon" d="M4 2v12l9-6z"/></svg><span data-rot-play-label>Pause</span></button>
        <button type="button" data-rot-next aria-label="Next phrase" title="Next phrase"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14m-6-6 6 6-6 6"/></svg></button>
      </span>
    </span>
  </span>
</span>
Run a headline rotator in Go
Run a headline rotator in Go
// Save as main.go in a module that imports Mono, then run go run .
package main

import (
	"bytes"
	"log"
	"net/http"

	mono "mono.local/mono"
)

func main() {
	const component = "animated-text-rotator"
	http.Handle("/mono/", http.StripPrefix("/mono/", mono.UI.Assets()))
	http.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) {
		var page bytes.Buffer
		page.WriteString("<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\"width=device-width, initial-scale=1\"><title>Studio practice</title>")
		if err := mono.UI.Head(&page, "/mono", component); err != nil {
			http.Error(w, "Could not load the component", http.StatusInternalServerError)
			return
		}
		page.WriteString("</head><body><main><h1>Made for ")
		err := mono.UI.Render(&page, component, mono.Props{
			"Words":  []string{"sketching.", "testing.", "making."},
			"Effect": "slide",
		})
		if err != nil {
			http.Error(w, "Could not render the headline", http.StatusInternalServerError)
			return
		}
		page.WriteString("</h1></main></body></html>")
		w.Header().Set("Content-Type", "text/html; charset=utf-8")
		w.Write(page.Bytes())
	})
	log.Fatal(http.ListenAndServe("127.0.0.1:8080", nil))
}
Go template
Go template
{{- $first := "" -}}
{{- range .Words}}{{if and . (not $first)}}{{$first = .}}{{end}}{{end -}}
<span id="{{.ID}}" data-mono="animated-text-rotator" class="mu-rot{{if .ShowControls}} mu-rot-player{{end}}"
  {{with .Effect}}data-effect="{{.}}"{{end}}
  {{if ne .Interval nil}}data-interval="{{.Interval}}"{{end}}
  {{if ne .Duration nil}}data-duration="{{.Duration}}"{{end}}
  {{if .Paused}}data-paused{{end}}>
  {{if .ShowControls}}<span class="mu-rot-picker" data-rot-picker role="group" aria-label="Animation effect" hidden>
    <span class="mu-rot-caption" aria-hidden="true">Effect</span>
    <span class="mu-rot-options" data-rot-options></span>
    <select class="mu-rot-select" data-rot-select aria-label="Animation effect"></select>
  </span>{{end}}
  <span class="mu-rot-stage">
    <span class="mu-rot-type">
      {{range .Words}}{{if .}}<span class="mu-rot-measure" data-rot-word dir="auto" aria-hidden="true">{{.}}</span>{{end}}{{end}}
      <span class="mu-rot-layer" data-rot-layer dir="auto" aria-hidden="true">{{$first}}</span>
      <span class="mu-sr-only" data-rot-reading>{{$first}}</span>
    </span>
    {{if .ShowControls}}<span class="mu-rot-transport" data-rot-transport hidden>
      <span class="mu-rot-position" aria-hidden="true"><span class="mu-rot-caption">Phrase</span> <b data-rot-index>01</b> / <span data-rot-total></span></span>
      <span class="mu-rot-actions" role="group" aria-label="Phrase playback">
        <button type="button" data-rot-prev aria-label="Previous phrase" title="Previous phrase"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5m6-6-6 6 6 6"/></svg></button>
        <button type="button" data-rot-play><svg width="12" height="12" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path class="mu-rot-pause-icon" d="M3 2h3v12H3zm7 0h3v12h-3z"/><path class="mu-rot-play-icon" d="M4 2v12l9-6z"/></svg><span data-rot-play-label>Pause</span></button>
        <button type="button" data-rot-next aria-label="Next phrase" title="Next phrase"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14m-6-6 6 6-6 6"/></svg></button>
      </span>
    </span>{{end}}
  </span>
</span>
Component CSS
Component CSS
.mu-rot[data-mono] {
  display: inline-grid;
  max-width: 100%;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  vertical-align: baseline;
}
.mu-rot-type { position: relative; display: inline-grid; max-width: 100%; min-width: 0; }
.mu-rot-layer, .mu-rot-measure {
  grid-area: 1 / 1;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.mu-rot-measure { visibility: hidden; pointer-events: none; }
.mu-rot-word, .mu-rot-mask, .mu-rot-glyph { display: inline-block; }
.mu-rot-word { max-width: 100%; }
.mu-rot-glyph { position: relative; transform-origin: 50% 80%; }
.mu-rot-mask { overflow: clip; vertical-align: bottom; }
.mu-rot-noise { position: absolute; inset: 0; overflow: hidden; text-align: center; }

.mu-rot-player[data-mono] {
  --rot-muted: #a5a5a5;
  --rot-line: #383838;
  display: grid;
  grid-template-columns: minmax(0,1fr);
  width: 100%;
  container-type: inline-size;
  overflow: clip;
  background: #111;
  color: #f6f6f6;
  font: 500 1rem/1.3 Inter, "Helvetica Neue", Arial, sans-serif;
  text-align: start;
}
.mu-rot-player:has(.mu-rot-picker:not([hidden])) { grid-template-columns: minmax(8rem, 22%) minmax(0, 1fr); }
.mu-rot-picker { display: flex; flex-direction: column; gap: 1rem; border-inline-end: 1px solid var(--rot-line); padding: 1.5rem .75rem; }
.mu-rot-caption { color: var(--rot-muted); font: 550 .66rem/1.2 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .10em; }
.mu-rot-picker > .mu-rot-caption { padding-inline: .5rem; }
.mu-rot-options { display: grid; gap: .13rem; }
.mu-rot-options label {
  position: relative; display: flex; align-items: center; gap: .65rem;
  min-height: 2rem; padding: .25rem .55rem; border-radius: .2rem;
  color: #bcbcbc; cursor: pointer; font-size: .86rem;
}
.mu-rot-options label::before {
  content: ""; width: .42rem; height: .42rem; flex: none;
  border: 1px solid #777; border-radius: 50%;
}
.mu-rot-options input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mu-rot-options label:hover { color: white; background: #202020; }
.mu-rot-options label:has(:checked) { color: white; background: #2b2b2b; }
.mu-rot-options label:has(:checked)::before { background: currentColor; border-color: currentColor; }
.mu-rot-options label:has(:focus-visible) { outline: 2px solid currentColor; outline-offset: 1px; }
.mu-rot-select { display: none; color-scheme: dark; border: 1px solid #555; border-radius: .25rem; background: #202020; padding: .45rem; }
.mu-rot-player .mu-rot-stage {
  display: grid; position: relative; min-width: 0; min-height: 17rem;
  grid-template-rows: minmax(0,1fr) auto; padding: clamp(1.35rem,4.5cqi,4rem);
  padding-bottom: 1.15rem;
}
.mu-rot-player .mu-rot-type {
  align-self: center; justify-self: start; padding-block: .3em;
  font-size: clamp(2.75rem, 10.3cqi, 8rem); line-height: 1.12;
  font-weight: 450; letter-spacing: -.065em;
}
.mu-rot-player .mu-rot-layer { perspective: 800px; }
.mu-rot-transport { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding-top: .75rem; border-top: 1px solid var(--rot-line); }
.mu-rot-position { color: var(--rot-muted); font: .72rem/1.2 ui-monospace, monospace; white-space: nowrap; }
.mu-rot-position b { color: white; font-weight: 600; }
.mu-rot-position .mu-rot-caption { margin-inline-end: .42rem; }
.mu-rot-actions { display: inline-flex; align-items: center; gap: .16rem; }
.mu-rot-actions button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-width: 2.15rem; min-height: 2.15rem; padding: .3rem; color: inherit; background: transparent; border: 1px solid transparent; border-radius: .25rem; }
.mu-rot-actions button:hover:enabled { background: #282828; }
.mu-rot-actions [data-rot-play] { min-width: 4.8rem; border-color: #505050; font-size: .77rem; }
.mu-rot-play-icon, [data-rot-stopped] .mu-rot-pause-icon { display: none; }
[data-rot-stopped] .mu-rot-play-icon { display: inline; }
@container (max-width: 34rem) {
  .mu-rot-picker { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; padding: .65rem 1rem; border: 0; border-bottom: 1px solid var(--rot-line); }
  .mu-rot-picker > .mu-rot-caption { padding: 0; }
  .mu-rot-options { display: none; }
  .mu-rot-select { display: block; min-width: 9rem; }
  .mu-rot-player .mu-rot-stage { grid-column: 1 / -1; min-height: clamp(13rem,60cqi,20rem); }
}
@container (max-width: 18rem) {
  .mu-rot-transport { flex-wrap: wrap; }
}
JavaScript module
JavaScript module
// Split only short labels. Keep connected scripts together so Arabic joins and
// Indic conjuncts retain their shaping even during letter-by-letter effects.
const rotatorGraphemes = typeof Intl.Segmenter === 'function'
  ? new Intl.Segmenter(undefined, {granularity: 'grapheme'}) : null;
const connectedScript = /[\u0600-\u08ff\u0900-\u0dff\u1000-\u109f\u1780-\u18af\ufb50-\ufdff\ufe70-\ufeff]/u;

function rotatorParts(layer, value, masked) {
  if (value.length > 768) return null;
  const fragment = document.createDocumentFragment();
  const parts = [];
  for (const word of value.match(/\s+|\S+/gu) || []) {
    if (/^\s/u.test(word)) {
      fragment.append(word);
      continue;
    }
    const letters = rotatorGraphemes && !connectedScript.test(word)
      ? Array.from(rotatorGraphemes.segment(word), part => part.segment) : [word];
    if (parts.length + letters.length > 64) return null;
    // Keep ordinary words on one line. Long strings and CJK can wrap within the run.
    const wrap = letters.length <= 16 && !/[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af]/u.test(word);
    const group = wrap ? document.createElement('span') : fragment;
    if (wrap) {
      group.className = 'mu-rot-word';
      fragment.append(group);
    }
    for (const letter of letters) {
      const glyph = document.createElement('span');
      glyph.className = 'mu-rot-glyph';
      glyph.textContent = letter;
      if (masked) {
        const mask = document.createElement('span');
        mask.className = 'mu-rot-mask';
        mask.append(glyph);
        group.append(mask);
      } else {
        group.append(glyph);
      }
      parts.push(glyph);
    }
  }
  if (!parts.length) return null;
  layer.replaceChildren(fragment);
  return parts;
}

function rotatorKeyframes(effect, arriving) {
  const rest = {opacity: 1, transform: 'none'};
  const y = arriving ? 1 : -1;
  let frames;
  switch (effect) {
    case 'blur':
      frames = [{opacity: 0, filter: 'blur(5px)'}, {opacity: 1, filter: 'blur(0px)'}];
      break;
    case 'mask-reveal':
      frames = [{transform: 'translateY(' + y * 108 + '%)'}, {transform: 'translateY(0%)'}];
      break;
    case 'slide':
      frames = [{opacity: 0, transform: 'translateX(' + y * .48 + 'em)'}, rest];
      break;
    case 'zoom':
      frames = [{opacity: 0, transform: 'scale(' + (arriving ? .65 : 1.22) + ')'}, rest];
      break;
    case 'flip-3d':
      frames = [{opacity: 0, transform: 'perspective(5em) rotateX(' + y * -86 + 'deg)'},
        {opacity: 1, transform: 'perspective(5em) rotateX(0deg)'}];
      break;
    case 'drop-bounce':
      frames = [{opacity: 0, transform: 'translateY(-.92em)'}, {opacity: 1, transform: 'translateY(.09em)'},
        {opacity: 1, transform: 'translateY(-.065em)'}, rest];
      break;
    case 'wave':
      frames = [{opacity: 0, transform: 'translateY(.4em) rotate(5deg)'},
        {opacity: 1, transform: 'translateY(-.19em) rotate(-3deg)'}, rest];
      break;
    default:
      frames = [{opacity: 0}, {opacity: 1}];
  }
  return arriving ? frames : frames.reverse();
}

function animateTextChange(layer, text, effect, duration, onFinish) {
  const previous = layer.textContent;
  let running = true;
  let animations = [];
  let frame = 0;
  function clearPhase() {
    for (const anim of animations) {
      anim.onfinish = null;
      anim.cancel();
    }
    animations = [];
    cancelAnimationFrame(frame);
  }
  function finish() {
    if (!running) return;
    running = false;
    clearPhase();
    layer.textContent = text;
    onFinish();
  }
  function phase(value, arriving, time, done) {
    if (!running) return;
    clearPhase();
    const parts = rotatorParts(layer, value, effect === 'mask-reveal');
    if (!parts) layer.textContent = value;
    if (effect === 'scramble' && parts) {
      const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
      const slots = parts.map(part => {
        const original = document.createElement('span');
        original.textContent = part.textContent;
        const noise = document.createElement('span');
        noise.className = 'mu-rot-noise';
        part.replaceChildren(original, noise);
        return {original, noise};
      });
      const start = performance.now();
      let lastTick = -1;
      function scramble(now) {
        if (!running) return;
        const progress = Math.min(1, Math.max(0, (now - start) / time));
        const tick = Math.floor((now - start) / 48);
        if (lastTick !== tick || progress === 1) {
          const resolved = Math.floor((arriving ? progress : 1 - progress) * slots.length);
          slots.forEach(({original, noise}, i) => {
            const hidden = i >= resolved;
            original.style.opacity = hidden ? '0' : '1';
            noise.textContent = hidden ? alphabet[Math.floor(Math.random() * alphabet.length)] : '';
          });
          lastTick = tick;
        }
        if (progress < 1) frame = requestAnimationFrame(scramble);
        else done();
      }
      scramble(start);
      return;
    }
    const targets = parts || [layer];
    const kind = parts ? effect : 'fade';
    const typewriter = kind === 'typewriter';
    const delaySpan = targets.length < 2 ? 0 : time * (typewriter ? .96 : kind === 'wave' ? .60 : .38);
    const keyframes = rotatorKeyframes(kind, arriving);
    for (let i = 0; i < targets.length; i++) {
      const order = typewriter && !arriving ? targets.length - i - 1 : i;
      const animation = targets[i].animate(keyframes, {
        duration: time - delaySpan,
        delay: delaySpan * order / Math.max(1, targets.length - 1),
        easing: typewriter ? 'steps(1,end)' : 'cubic-bezier(.25,.65,.3,1)',
        fill: 'both'
      });
      animations.push(animation);
      if (order === targets.length - 1) animation.onfinish = done;
    }
  }
  if (!(duration > 0) || !layer.animate) {
    finish();
  } else if (previous) {
    phase(previous, false, duration * .36, () => phase(text, true, duration * .64, finish));
  } else {
    phase(text, true, duration, finish);
  }
  return () => {
    running = false;
    clearPhase();
  };
}

const rotatorEffects = new Map([
  ['blur', 'Blur'], ['fade', 'Fade'], ['mask-reveal', 'Mask reveal'], ['slide', 'Slide'],
  ['zoom', 'Zoom'], ['flip-3d', 'Flip 3D'], ['drop-bounce', 'Drop & Bounce'],
  ['wave', 'Wave'], ['typewriter', 'Typewriter'], ['scramble', 'Scramble']
]);

function milliseconds(value, fallback, min, max) {
  const number = value?.trim() ? Number(value) : NaN;
  return Number.isFinite(number) ? Math.max(min, Math.min(max, number)) : fallback;
}

export function mount(root) {
  const words = [...root.querySelectorAll('[data-rot-word]')].map(el => el.textContent).filter(s => s.trim());
  const layer = root.querySelector('[data-rot-layer]');
  if (!layer || !words.length) return;
  const reading = root.querySelector('[data-rot-reading]');
  const picker = root.querySelector('[data-rot-picker]');
  const transport = root.querySelector('[data-rot-transport]');
  const position = root.querySelector('[data-rot-index]');
  const play = root.querySelector('[data-rot-play]');
  const reduced = window.matchMedia('(prefers-reduced-motion: reduce)');
  const interval = milliseconds(root.dataset.interval, 2000, 250, 60000);
  const duration = milliseconds(root.dataset.duration, 650, 0, 3000);
  let effect = rotatorEffects.has(root.dataset.effect) ? root.dataset.effect : 'blur';
  let paused = root.hasAttribute('data-paused');
  let inView = !('IntersectionObserver' in window);
  let index = 0, timer = 0, cancelEffect = null;

  function schedule() {
    clearTimeout(timer);
    if (words.length > 1 && !paused && !reduced.matches && inView && !document.hidden && root.isConnected) {
      timer = setTimeout(() => show(index + 1), interval);
    }
  }

  // Stop on a complete phrase so interrupting a stagger never leaves half a word.
  function stop() {
    clearTimeout(timer);
    cancelEffect?.();
    cancelEffect = null;
    layer.textContent = words[index];
  }

  function show(next) {
    stop();
    index = (next + words.length) % words.length;
    reading.textContent = words[index];
    if (position) position.textContent = String(index + 1).padStart(2, '0');
    if (reduced.matches || !inView || !duration || !layer.animate) {
      layer.textContent = words[index];
      schedule();
      return;
    }
    cancelEffect = animateTextChange(layer, words[index], effect, duration, () => {
      cancelEffect = null;
      schedule();
    });
  }

  function playback() {
    if (!play) return;
    const stopped = paused || reduced.matches;
    play.disabled = words.length < 2 || reduced.matches;
    play.toggleAttribute('data-rot-stopped', stopped);
    play.querySelector('[data-rot-play-label]').textContent = stopped ? 'Play' : 'Pause';
    play.setAttribute('aria-label', stopped ? 'Play rotation' : 'Pause rotation');
    play.title = reduced.matches ? 'Automatic rotation is off for reduced motion' : play.getAttribute('aria-label');
  }

  layer.textContent = reading.textContent = words[0];
  if (picker) {
    const options = picker.querySelector('[data-rot-options]');
    const select = picker.querySelector('[data-rot-select]');
    for (const [value, name] of rotatorEffects) {
      const label = document.createElement('label');
      const radio = document.createElement('input');
      radio.type = 'radio';
      radio.name = root.id + '-animation';
      radio.value = value;
      radio.checked = value === effect;
      label.append(radio, name);
      options.append(label);
      select.add(new Option(name, value));
    }
    select.value = effect;
    picker.addEventListener('change', event => {
      const value = event.target.value;
      if (!rotatorEffects.has(value)) return;
      effect = select.value = value;
      for (const radio of options.querySelectorAll('input')) radio.checked = radio.value === effect;
      show(index);
    });
    picker.hidden = false;
    transport.hidden = false;
    transport.querySelector('[data-rot-total]').textContent = String(words.length).padStart(2, '0');
    for (const [selector, step] of [['[data-rot-prev]', -1], ['[data-rot-next]', 1]]) {
      const button = transport.querySelector(selector);
      button.disabled = words.length < 2;
      button.addEventListener('click', () => show(index + step));
    }
    play.addEventListener('click', () => {
      paused = !paused;
      playback();
      if (paused) stop();
      else schedule();
    });
    playback();
  }
  if (words.length === 1 && !picker) return;

  function visibilityChanged() {
    if (document.hidden || reduced.matches) stop();
    else if (!cancelEffect) schedule();
    playback();
  }
  // Global listeners are only needed while this instance is on screen.
  function observePlayback(visible) {
    inView = visible;
    if (visible) {
      document.addEventListener('visibilitychange', visibilityChanged);
      reduced.addEventListener('change', visibilityChanged);
      visibilityChanged();
    } else {
      document.removeEventListener('visibilitychange', visibilityChanged);
      reduced.removeEventListener('change', visibilityChanged);
      stop();
    }
  }
  if ('IntersectionObserver' in window) {
    const observer = new IntersectionObserver(([entry]) => observePlayback(entry.isIntersecting));
    observer.observe(root);
  } else {
    observePlayback(true);
  }
}
Use the HTML in a static site

Copy the rendered HTML above. Download these assets into the same folder as your page, then add the tags below to its head.

Shared CSS Component CSS Ready-to-use module

HTML head
<link rel="stylesheet" href="./base.css">
<link rel="stylesheet" href="./animated-text-rotator.css">
<script type="module" src="./animated-text-rotator.js"></script>

Copy into your project

Run this command from the Mono checkout. Set -out to the component directory in your application.

Terminal
go run ./cmd/mono-ui add -out ./components animated-text-rotator
Example properties (JSON)
example.json
{
  "Duration": 650,
  "Effect": "blur",
  "Interval": 2000,
  "ShowControls": true,
  "Words": [
    "Hello,",
    "Welcome.",
    "Stay curious.",
    "Make things."
  ]
}