Components

Scan Line

A CRT scan line overlay for React: wrap any element to add retro horizontal scanlines, a slowly rolling scan bar, and optional vignette, flicker and screen curvature. Pure CSS with Tailwind — no JavaScript, Server Component friendly, and it never blocks clicks.

  • Pure CSS
  • Server Component friendly
  • pointer-events-none
  • Retro CRT
  • prefers-reduced-motion

Last login: Mon Nov 23 09:14

Connected to prod-eu-1

3 deploys are queued. Run deploy status to see them.

Installation

$ npx shadcn@latest add https://duskui.com/r/scan-line.json

No dependencies and no "use client". The keyframes ship in a React 19 <style precedence> tag that's hoisted and de-duplicated automatically.

Usage

screen.tsx
import { ScanLine } from "@/components/dusk/hacker/scan-line"

export function Screen() {
  return (
    <ScanLine className="rounded-xl bg-black p-8">
      <h2 className="font-mono text-primary">ACCESS GRANTED</h2>
    </ScanLine>
  )
}

Examples

Retro CRT

Turn on curvature and flicker, space the lines with lineSpacing and lineOpacity, and tint the scan bar with barColor and barDuration.

READY.

10 PRINT "HELLO"

20 GOTO 10

RUN

Over Matrix Rain

It wraps anything — including canvas backgrounds like MatrixRain, which fills the relative wrapper.

API Reference

Also accepts any <div> prop. The wrapper is relative overflow-hidden.

PropTypeDefaultDescription
linesbooleantrueDraw horizontal scanlines.
lineSpacingnumber3Distance between scanlines, in px (min 2).
lineOpacitynumber0.25Darkness of each scanline, 0–1.
barbooleantrueShow the rolling scan bar.
barDurationnumber7Seconds for the bar to travel top to bottom.
barColorstring"rgb(255 255 255)"Bar color; any CSS color.
vignettebooleantrueDarken the edges like a CRT tube.
flickerbooleanfalseSubtle brightness flicker, under one blip per second.
curvaturebooleanfalseRounded tube corners, inner shadow and glass glare.
overlayClassNamestring—Classes for the overlay layer.

Accessibility

  • The overlay is aria-hidden and pointer-events-none, so links, buttons and text selection underneath keep working.
  • The flicker is a tiny brightness change (a few percent) at well under one blip per second — far below the 3-flashes-per-second threshold.
  • With prefers-reduced-motion the scan bar is hidden and the flicker stops; static lines and vignette remain.
  • Scanlines and vignette darken content, so check text contrast and lower lineOpacity for small text.