Gradient Border
ProRotating conic gradient border using @property CSS animation. Works on any element.
Borders · primitive · intermediate · css · zero dependencies
Animated in one wrapper
The border is a single conic gradient rotating behind a one-pixel inset — no SVG, no extra element to position.
ember 6s · bone 2.5s · radius 14 / 8 / 100
Rotating conic gradient border using @property CSS animation. Works on any element.
- highlighted pricing plan border
- featured product card outline
- call-to-action button frame
- most-popular plan badge border
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | — | Content rendered inside the bordered container. |
className | string | — | Additional classes for the inner content container. |
containerClassName | string | — | Additional classes for the outer gradient container. |
colors | string[] | ["#a78bfa", "#818cf8", "#c084fc", "#f472b6", "#a78bfa"] | Conic-gradient color stops — first and last should match for a seamless loop. |
borderWidth | number | 1 | Thickness of the visible border in pixels. |
duration | number | 4 | Full rotation time in seconds. |
borderRadius | string | "12px" | Corner radius applied to both the outer border and inner content. |
Does Gradient Border work with Next.js App Router?
Yes. It's a "use client" React component. Note that the @property rule needs a browser that supports the CSS @property API, which all evergreen browsers do.
Are there any dependencies to install?
None. It's pure CSS — a @property-registered custom property animated with @keyframes.
Is it responsive?
Yes. It wraps its children with padding equal to borderWidth, so it resizes with whatever you put inside it; borderRadius can be adjusted per breakpoint via className overrides.
Does it respect prefers-reduced-motion?
Not automatically. The border rotates continuously via a CSS keyframe animation with no reduced-motion media query built in. Wrap the animation in your own @media (prefers-reduced-motion: reduce) block if you need to freeze it.