Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Text

Pro

Flickering Text for React

Text that flickers like a failing fluorescent sign, letters dipping and blinking on their own rhythms. For React with Base UI, when a headline should feel like a sign that's seen better days.

Framework

Flickering Text makes a line flicker like a tube that's about to go: some letters hold steady while others dip dim or blink, each on its own irregular rhythm, so the pattern never looks mechanical. It's brightness only: no letter moves or changes colour.

Use it for a short headline with a late-night, run-down feel, on its own or with a glow of your own. For a sign that works, with a halo and a single tired letter, use Neon Text; for text that tears and jumps, Glitch Text. It's CSS only: each flickering letter runs one of three keyframe rhythms of abrupt dips, added to your stylesheet by the install, its length and phase worked out from its place, so it looks random while the server and the browser draw the same. No letter dips more than three times a second, it steadies while the pointer is over it, and with reduced motion it doesn't flicker.

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Usage

import { FlickeringText } from "@/components/ui/flickering-text";
<h2>
  <FlickeringText text="No vacancy tonight" />
</h2>

Demos

Intensity

intensity is how hard it flickers: subtle dims a few letters a little, and rarely; medium, half of them, to a third of their brightness; strong, nearly all of them, nearly dark and more often.

Preview width

Glow

Flickering Text changes only the letters' opacity, so a glow of your own flickers with them: give the text a text-shadow in currentColor, here on a sky-blue sign.

Preview width

Accessibility

Screen readers read the text once, from a visually hidden copy; the flickering letters are hidden from them. No letter dips more than three times a second, the whole line steadies while the pointer is over it, and with reduced motion it holds still at full brightness. Words wrap whole, and the line keeps its direction on a right-to-left page.

FAQ

Is the flicker random?

It looks random but isn't: which letters flicker, their rhythm, its length and its phase all come from a small formula of each letter's place, so the server and the browser draw the same and the page never mismatches.

Is it safe for people sensitive to flashing?

No letter dips more than three times a second, the threshold the accessibility guidelines set, at any intensity, and it's off entirely when the system asks for reduced motion.

How do I set its colour?

It takes the text's colour, so set it on the text or the element around it, such as className="text-sky-500". A dip is a drop in opacity, so any colour flickers the same way.

How do I add a neon glow?

Give the text a text-shadow in currentColor, such as [text-shadow:0_0_0.15em_currentColor]: each letter's glow dims with it. For a full sign, with a halo that breathes, use Neon Text.

Why does it stop when I point at it?

So it can be read: the letters steady while the pointer is over the text, and pick up their flicker when it leaves.

What happens with reduced motion?

The letters hold still at full brightness; the text reads as plain text.

API Reference

FlickeringText

<span> data-slot="flickering-text"

PropType
textstring

The text.

intensity?"subtle" | "medium" | "strong"

How hard the letters flicker: how dim they drop and how often, from a rare dip to a failing tube.

Type
"subtle" | "medium" | "strong"
Default
"medium"
render?ReactElement | ((props: object, state: object) => ReactElement)

Replace the host element or compose it with another component.

Type
ReactElement | ((props: object, state: object) => ReactElement)
className?string

Merged with the part's classes.

CSS variableType
--flickering-text-dipstring

How dim a letter drops, an opacity (0.35).

--flickering-text-durationstring

One round of a letter's rhythm, about (4s).

All 97 text effects