# Neon Sign

> Glass-tube lettering that flickers on letter by letter like a sign warming up, white-hot at the core with its colour glowing onto the wall behind.

Category: Text · Free · Updated 2026-11-10 · Live demo: https://www.motionkitui.com/components/neon-sign

## When to use it

Nightlife, music and events sites, bars and restaurants, retro and arcade brands, and launch pages that want a bit of after-dark atmosphere.

## How it works

Each letter is drawn twice in the same spot: a faint copy for the unlit glass tube, and a lit copy above it with a near-white core and stacked text shadows in the tube colour, from a tight edge glow out to a wide halo. When the sign scrolls into view, every lit letter runs a short keyframe of stutters (on, off, half, on) from its own fixed delay, so the letters catch one after another. A soft radial pool of the same colour fades in behind for the light on the wall, and one letter can keep a buzz loop for a tired tube. The real text sits once in a visually hidden span for screen readers.

## Installation

```bash
npx shadcn@latest add https://www.motionkitui.com/r/neon-sign.json
```

Or copy `components/motionkit/neon-sign.tsx` below. Requires react, motion and Tailwind CSS v4. Free for personal projects; commercial use needs MotionKit Plus (https://www.motionkitui.com/pricing).

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `text` | `string` |  | The words on the sign. |
| `color` | `string` | `"#FF6FB5"` | Colour of the gas in the tubes. |
| `ignite` | `boolean` | `true` | Flicker on, letter by letter, when it scrolls into view. Off, it's simply lit. |
| `buzz` | `number` |  | Position of one letter (from 0) that keeps buzzing, like a tired tube. |
| `glow` | `number` | `0.8` | Strength of the halo, 0 to 1. |
| `wall` | `boolean` | `true` | Cast a soft pool of coloured light on the wall behind. |
| `as` | `ElementType` | `"span"` | Element to render, e.g. h1. |

## Accessibility

- **Keyboard: Not applicable.** Text, not a control.
- **Screen readers: Pass.** Your text is read once from a visually hidden copy; the letter tubes are hidden.
- **Reduced motion: Pass.** With reduced motion on, the sign is simply lit: no flicker on, no buzzing letter.
- **Colour contrast: Pass.** The lit tubes are mostly white: the default pink core measures 14:1 on the site's dark.

## Source

```tsx
"use client";

import { useRef, type CSSProperties, type ElementType } from "react";
import { useInView } from "motion/react";

type NeonSignProps = {
  text: string;
  /** Colour of the gas in the tubes. */
  color?: string;
  /** The element to render, e.g. "h1". */
  as?: ElementType;
  /** Flicker on, letter by letter, like a sign warming up when it scrolls into view. Off, it's simply lit. */
  ignite?: boolean;
  /** The position of one letter (from 0) that keeps buzzing, as a tired tube does. Leave out for a perfect sign. */
  buzz?: number;
  /** Strength of the halo round the tubes, 0 to 1. */
  glow?: number;
  /** Cast a soft pool of coloured light on the wall behind. */
  wall?: boolean;
  className?: string;
};

// a fixed scatter, so each letter catches at its own moment but the sign behaves the same on every visit
const delay = (index: number) => (((index * 7919) % 11) / 11) * 0.7;

/**
 * Glass-tube lettering. Unlit, the tubes show faintly; then each letter catches with a stutter, glowing white-hot at
 * the core with its colour bleeding out into a halo and onto the wall behind. One letter can keep buzzing.
 */
export function NeonSign({ text, color = "#FF6FB5", as: Tag = "span", ignite = true, buzz, glow = 0.8, wall = true, className = "" }: NeonSignProps) {
  const ref = useRef<HTMLElement>(null);
  const inView = useInView(ref, { once: true, amount: 0.5 });
  const on = inView || !ignite;
  const strength = Math.min(1, Math.max(0, glow));
  const halo = (share: number) => `color-mix(in srgb, ${color} ${Math.round(share * strength * 100)}%, transparent)`;

  const lit: CSSProperties = {
    color: `color-mix(in srgb, ${color} 30%, white)`,
    textShadow: `0 0 1px rgb(255 255 255 / 0.6), 0 0 0.05em ${color}, 0 0 0.14em ${color}, 0 0 0.35em ${halo(0.7)}, 0 0 0.8em ${halo(0.45)}`,
  };

  return (
    <Tag ref={ref} data-neon="" data-on={on ? "" : undefined} data-instant={ignite ? undefined : ""} className={`relative isolate inline-block ${className}`}>
      <style>{`
@keyframes neon-ignite{0%{opacity:0}7%{opacity:.9}9%{opacity:0}22%{opacity:0}24%{opacity:1}28%{opacity:.15}33%{opacity:1}58%{opacity:.8}100%{opacity:1}}
@keyframes neon-buzz{0%,38%,42%,44%,78%,80%,100%{opacity:1}39%{opacity:.1}41%{opacity:.6}43%{opacity:.05}79%{opacity:.35}}
[data-neon] .neon-lit{opacity:0}
[data-neon][data-on] .neon-lit{animation:neon-ignite 1.1s linear var(--neon-delay) both}
[data-neon][data-on] .neon-lit[data-buzz]{animation:neon-ignite 1.1s linear var(--neon-delay) both,neon-buzz 5.5s linear calc(var(--neon-delay) + 2s) infinite}
[data-neon][data-instant] .neon-lit{animation-name:none;opacity:1}
[data-neon][data-instant] .neon-lit[data-buzz]{animation:neon-buzz 5.5s linear infinite}
[data-neon] .neon-wall{opacity:0;transition:opacity 1.4s ease .5s}
[data-neon][data-on] .neon-wall{opacity:1}
@media (prefers-reduced-motion:reduce){[data-neon] .neon-lit{animation:none!important;opacity:1}[data-neon] .neon-wall{transition:none}}
`}</style>
      {wall && (
        <span
          aria-hidden
          className="neon-wall pointer-events-none absolute -inset-x-[15%] -inset-y-[60%] -z-10"
          style={{ background: `radial-gradient(closest-side, ${halo(0.28)}, transparent)` }}
        />
      )}
      <span className="sr-only">{text}</span>
      <span aria-hidden className="whitespace-pre">
        {Array.from(text).map((char, index) => (
          <span key={index} className="relative inline-block whitespace-pre">
            {/* the unlit glass tube, faintly visible before and between flickers */}
            <span style={{ color: `color-mix(in srgb, ${color} 22%, transparent)` }}>{char}</span>
            <span
              className="neon-lit absolute inset-0"
              data-buzz={index === buzz ? "" : undefined}
              style={{ ...lit, "--neon-delay": `${delay(index).toFixed(2)}s` } as CSSProperties}
            >
              {char}
            </span>
          </span>
        ))}
      </span>
    </Tag>
  );
}
```
