DanielWhit21874

Slot Text

Text 8

About

Dependency-free text-roll animation for tiny, tactile UI labels. Each character sits in its own clipped cell and slides to its new glyph with a springy overshoot — the new glyph enters from one side while the old slides out the other, chasing it by a stagger step. Pure CSS transforms, GPU-composited. Thin React wrapper over the slot-text package (npm i slot-text); supports direction, stagger, bounce and a chromatic color sweep.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Slot Text to your project and fits it to your theme.

Code

How Slot Text is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import { useEffect, useState } from "react"

import { SlotText } from "@/components/ui/slot-text"

export default function SlotTextCounter() {
  const [value, setValue] = useState(12480)

  useEffect(() => {
    const id = setInterval(() => {
      setValue((v) => {
        const next = v + Math.floor(Math.random() * 240) - 110
        return Math.min(13200, Math.max(11800, next))
      })
    }, 1200)
    return () => clearInterval(id)
  }, [])

  return (
    <div className="flex min-h-[220px] w-full items-baseline justify-center gap-2">
      <SlotText
        text={value.toLocaleString("en-US")}
        className="text-3xl font-semibold tabular-nums"
        options={{ direction: "up", skipUnchanged: false }}
      />
      <span className="text-sm text-muted-foreground">req/s</span>
    </div>
  )
}

Dependencies

More in Text

View all
  • Vertical Cut Reveal Characters

    Vertical Cut Reveal Characters

    103
  • Rainbow Text Effect

    Rainbow Text Effect

    47
  • Motion Blur Text

    Motion Blur Text

    36
  • Text Loop

    Text Loop

    310
  • Text Reveal

    Text Reveal

    27
  • Apple Hello Effect

    Apple Hello Effect

    610
  • Typography

    Typography

    4
  • Animated Text

    Animated Text

    8