Skip to content
Template Empire
Browse components

Gradient Border Card

A free card component with a slowly rotating gradient edge.

Kirkgate Library of Things

Borrow the drill, not the storage

Four hundred things on the shelves, from a wallpaper steamer to a carpet cleaner. Membership is £25 a year, you reserve online, and most items go out for a week at a time.

See what’s on the shelves

Gradient Border Card is a free card component for Next.js and React, styled with Tailwind, that rotates a conic gradient behind an opaque content surface. It is a gradient border card react css pattern with a fixed one-pixel edge and no gradient-angle repaint.

One oversized square rotates using a single CSS transform and pauses whenever the card is fully offscreen, the document is hidden or a user hovers or focuses within the card. Interactive children keep their own semantics and focus styles, while prefers-reduced-motion leaves the complete border visible and static at its authored position.

Install

Add the @te registry to your components.json once:

{
  "registries": {
    "@te": "https://templateempire.io/r/{name}.json"
  }
}

Then install the component:

npx shadcn@latest add @te/card-gradient-border

Usage

import { CardGradientBorder } from "@/components/ui/card-gradient-border";

export default function Page() {
  return (
    <CardGradientBorder className="max-w-md">
      <article className="space-y-3">
        <h2 className="text-xl font-semibold">A card with a moving edge</h2>
        <p className="text-muted-foreground">Your content remains completely still.</p>
      </article>
    </CardGradientBorder>
  );
}

Props

PropTypeDefaultDescription
childrenReactNoderequiredCard content, including any interactive children.
classNamestringundefinedAdditional classes merged onto the card root.

Customisation

Gradient Border Card exposes three Tier 3 tokens. --card-border-from and --card-border-to set the two semantic colour stops with Template Empire and vanilla shadcn fallbacks, while --card-border-dur sets one full rotation period. Override them from :root or any ancestor:

:root {
  --card-border-from: var(--color-brand-500, var(--primary));
  --card-border-to: var(--color-accent-400, var(--ring));
  --card-border-dur: 9s;
}

Frequently asked questions

Is Gradient Border Card free for commercial use?
Yes. Gradient Border Card is MIT licensed, so you can use it in personal and commercial projects without attribution.
Is Gradient Border Card accessible and performant?
Yes. The decorative layer cannot receive pointer input or focus, and the opaque semantic background keeps content contrast independent from the border. One transform rotates while the gradient stays static, the loop pauses offscreen, in a hidden document, on hover or during focus within, and reduced motion stops it completely.
How do I customise the border colours or speed?
Override --card-border-from and --card-border-to with semantic colour tokens, then set --card-border-dur to the desired rotation period. The built-in nested fallbacks work in both Template Empire and vanilla shadcn themes.

Related components

Want the full page this belongs to?Template Empire builds complete Next.js templates with this motion system throughout. Browse the paid templates that pair with these free components.Explore Template Empire templates