Components

Neon Border

An animated neon border for any React element: a beam of light travels around a thin edge with a faint glow. Built with Motion and Tailwind CSS using a masked conic gradient, so it fits cards, pricing tables, pills and inputs at any size or aspect ratio.

  • Wraps any content
  • Travelling light beam
  • Hover trigger
  • Pauses off-screen
  • prefers-reduced-motion

Pro

$12/mo

  • Unlimited projects
  • Priority support
  • Custom domains

Installation

$ npx shadcn@latest add https://duskui.com/r/neon-border.json

The border sits outside your content, so give the content its own background (for example contentClassName="bg-card") to keep the glow from tinting it.

Usage

featured-plan.tsx
import { NeonBorder } from "@/components/dusk/neon/neon-border"

export function FeaturedPlan() {
  return (
    <NeonBorder radius={20} contentClassName="bg-card p-6">
      <h3>Pro</h3>
      <p>Everything in Free, plus…</p>
    </NeonBorder>
  )
}

Examples

On hover

With trigger="hover" the beam only lights up while the pointer is over the element or keyboard focus is inside it — great for link cards.

Two-tone & pill

secondaryColor fades the beam's tail into a second color. Set a large radius for pills and badges, and tune thickness, glow and speed.

Two-tone

A second color and a 2px border

Version 2.0 is out

API Reference

Also accepts any <div> prop for the outer wrapper.

PropTypeDefaultDescription
colorstringvar(--color-primary)Any CSS color for the beam and the dim resting tube.
secondaryColorstring—Color the beam's tail fades into.
speednumber6Seconds per lap around the border.
thicknessnumber1Border width in px.
radiusnumber | string12Corner radius in px or any CSS length.
glownumber0.5Soft glow around the beam, from 0 (off) to 1.
trigger"always" | "hover""always"Run continuously, or only on hover / focus-within.
contentClassNamestring—Classes for the inner content wrapper.

Accessibility

  • All border and glow layers are aria-hidden and pointer-events-none; your content keeps its own semantics and focus order.
  • The hover trigger also responds to keyboard focus anywhere inside the wrapper.
  • The beam moves smoothly with no flashing, and the animation pauses while the element is off-screen.
  • With prefers-reduced-motion the beam stops and the whole border stays steadily lit.