shadcn.io is not affiliated with official shadcn/ui
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.
Installation
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.
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.
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.
API Reference
NeonText
<span> data-slot="neon-text"
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.
data-char?string
Mirrors value.
--neon-text-colorstring
The tube's colour (a hot pink by default).
Related
- Pro
Flickering Text
DecorativeLetters that fail and blink
Gradient Text
DecorativeColour that flows instead of glows
- Pro
Chromatic Text
DecorativeA red and cyan split, not a glow
- Pro
Dot Matrix Text
DecorativeA sign lit in LED dots
- Pro
Text Hover Effect
InteractiveAn outline lit under the pointer
- Pro
Glitch Text
DecorativeA sign that tears instead of hums