Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Text

Pro

Neon Text for React

Text lit like a neon sign, a bright tube in a halo of its own colour that flickers on and hums. For React with Base UI, when a headline on a dark surface should glow.

Framework

Neon Text lights a line like a sign: each letter is a bright tube in a soft halo of its own colour. It flickers on when the page shows it, the halo breathes, and every couple of seconds a tired letter buzzes for a moment.

Use it for a short headline or a label on a dark surface, where the glow reads as light; on a light page it shows as coloured letters in a softer halo. For letters that fail and blink, use Flickering Text; for colour that flows, Gradient Text. It's CSS only: the glow is shadows that never animate, each letter's halo is a copy behind it whose opacity breathes, and the keyframes the install adds to your stylesheet only dim the letters, never more than three times a second. With reduced motion the sign is simply on.

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 { NeonText } from "@/components/ui/neon-text";
<h1>
  <NeonText text="Open all night" />
</h1>

Demos

Colors

color is the tube, any CSS colour: the letters take it on a light page, and on a dark one it's the glow around a whiter core. Choose a saturated colour; a grey tube doesn't glow.

Preview width

Sign

On a dark surface the halo reads as light, like a sign at night; the dark class gives a section your theme's dark colours. flicker={false} turns a sign on without the flicker, for a second line that shouldn't compete with the first.

Preview width

Accessibility

Screen readers read the text once, from a visually hidden copy; the glowing letters are hidden from them. The switch-on flicker and the buzz never pass three flashes a second, the buzz stops while the pointer is over the text, and with reduced motion nothing flickers or breathes. In forced-colors mode the glow is dropped and the letters take the system's text colour. On a light page, check the contrast of color against it.

FAQ

Can it turn on without the flicker?

Yes: pass flicker={false} and the sign is on from the first frame, its halo breathing and a letter buzzing now and then. Use it when the text is part of a larger entrance, or for a second line under a sign that already flickers.

What is the buzz?

A tired tube: four letters, picked by a small formula of their place, take turns to dim for a moment, one every two seconds, never two at once. It's the same on every render, and it stops while the pointer is over the text.

Does it work on a light page?

Yes, as coloured letters in a softer halo, so they stay sharp. Neon reads as light only on a dark surface: put it in a dark section, such as one with the dark class, which gives it your theme's dark colours.

Can the tube use my theme's colours?

Yes: color takes any CSS colour, including a theme variable such as var(--chart-1). Choose a saturated one; it's the colour of the letters on a light page and of the glow on a dark one.

Is the glow expensive?

Little. The shadows are drawn once and never animated; only opacity changes, which the browser composites without repainting the text. Keep it to a headline or a label rather than a paragraph.

Is the flicker safe for people sensitive to flashing?

It stays under three flashes a second, the threshold the accessibility guidelines set, and it's off entirely when the system asks for reduced motion.

What happens with reduced motion?

The sign is on from the start and holds still: no flicker, no buzz, and the halo doesn't breathe.

API Reference

NeonText

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

PropType
textstring

The text.

color?string

The tube's colour, any CSS colour: the letters, and the glow around them. By default a hot pink.

flicker?boolean

Whether it flickers on like a sign when the page shows it. @default true.

Default
true
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.

AttributeType
data-char?string

Mirrors value.

CSS variableType
--neon-text-colorstring

The tube's colour (a hot pink by default).

All 97 text effects