Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Centered Animated Gradient Border Hero Block for React

A centered hero between solid rails whose offer sits in a card with a slowly turning sweep of the theme's foreground color around its border, with a Shine Button, an outline button and a row of three stats.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A centered hero framed by an animated gradient border, for React with Base UI, shown here for Quay, a payments API for marketplaces. A sweep of the theme's foreground color turns slowly around the card's two-pixel border, drawing the eye to the offer without any images, and the card is framed with + marks on its corners between the page's solid rails. Above the card sits an Announcement link; inside it, the headline, a subtitle, a Shine Button beside an outline Button, and a row of three stats under a hairline; under it, a line of pricing fine print. The border is a conic gradient turned with Tailwind's animate-spin, so it needs no custom CSS or keyframes and stays still under reduced motion. The look is monochrome, so it suits every theme and the primary color stays on the one button. Built with Announcement, Status, Shine Button, Button and Guides, with Lucide icons and Tailwind CSS. Made for developer platforms, launch pages and SaaS products that want one premium accent around the main message.

FAQ

How does the animated border work without custom CSS?

The card's frame is a wrapper with p-0.5, overflow-hidden and rounded corners, and the card sits inside it on bg-card, so only a two-pixel ring of the wrapper shows. Behind the card, an aria-hidden square much larger than the frame is painted with a conic-gradient and turned by Tailwind's built-in animate-spin; the frame clips it to the ring. Turning a layer is a transform, which the browser composites without repainting, so the page stays smooth while it spins.

How do I change the border's colors?

The gradient on the spinning square goes from var(--foreground) through 25% and fully transparent stops, made with color-mix(in oklab, var(--foreground) 25%, transparent), and back. Where it's transparent, the frame's own bg-border shows, so the card keeps a plain border all the way round. Swap var(--foreground) for any token, such as var(--primary), if you want a colored sweep. Use the token as it is: the theme's colors are oklch values, so hsl(var(--primary)) would be an invalid color and draw nothing.

How do I change the speed or the thickness of the border?

[animation-duration:6s] on the spinning square sets one full turn; 3–4s feels energetic, 8–10s calmer. The frame's padding is the thickness: p-px for a hairline, p-1 for a bolder ring. The card inside rounds its corners to the frame's radius minus the padding, rounded-[max(0px,calc(var(--radius-2xl)-2px))], so change the 2px with it, and the corners follow your theme's radius.

What happens with reduced motion?

The border stops turning: motion-reduce:animate-none leaves the gradient at rest, a still ring that's darker at the top. The announcement, the card and the fine print fade up once on load through Tailwind's starting: variant, and motion-reduce:transition-none removes that too, so everything renders in place. The block has no state and runs no script.

Is this hero accessible?

Yes. The headline is the page's one h1, and the spinning layer is decorative and hidden from assistive technology. The announcement and both calls to action are links named by their text, and the stats are a description list, so each figure is read with its label. Values with units such as <50 ms and 12K+ are isolated with bdi, and the price with dir="ltr", so their signs stay in place in right-to-left languages. On Base UI, each button renders its link with render={<a href="#" />} and nativeButton={false}.

When should I use a gradient border hero instead of a plain centered hero?

Use it for a launch or a premium product where one moving accent should frame the offer, with no artwork to produce. Keep it to one per page: a second animated border competes with the first. Use a plain centered or gradient-wash hero when the copy should stand on its own, or when the page already has motion elsewhere.

  • Pro

    A compact centered hero under a soft monochrome glow, with the side rails fading in from the top, an announcement link, a Shine Button, an avatar row and a band of three figures.

  • Pro

    A start-aligned statement hero whose headline ends on two words that fade from the text color toward the page, with a Shine Button, an outline button and a ruled band of three proof cells.

  • Pro

    A centered showcase hero over a quiet monochrome mesh that drifts slowly behind the section, with a Shine Button, an outline button and a framed window of a moodboard canvas that runs on below the fold.

  • Pro

    A split hero between solid rails: a headline with a Shine Button and an outline button on one side, and on the other a framed panel where soft orbs of the theme's foreground drift slowly behind three stats.

  • Pro

    A compact centered hero whose second headline line glints as a light runs through it, with a launch pill, the Shine Button and four stats in cells below.

  • Pro

    Centered Minimal Hero

    Type and motion

    A compact centered type-only hero: a two-line headline with a muted second line, one sentence, a Shine Button and a second action, on faded rails.