Glow · Sale
A sale banner lit rose from the top right, with a large discount figure, two lines of copy and a link. Recolor it by changing one CSS variable.
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
// The copy: change text here, not in the markup.
const COPY = {
amount: "30%",
label: "Off everything",
detail: "Three days, then the lights go down.",
action: "Shop the sale",
} as const
/** A sale banner lit rose from the top right. Change `--glow` to recolor it. */
export default function BannerGlowSale() {
return (
<div className="relative isolate w-full overflow-hidden rounded-2xl bg-slate-950 text-white [--glow:244_63_94]">
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_right_top,rgb(var(--glow)/0.3)_0%,transparent_70%)]"
/>
<div className="relative z-10 flex flex-col gap-6 p-8 sm:flex-row sm:items-end sm:justify-between sm:p-10">
<div className="flex items-end gap-5">
<p className="font-mono text-7xl/none font-light tracking-tighter">
{COPY.amount}
</p>
<div className="pb-1">
<p className="font-mono text-xs tracking-[0.18em] text-white/70 uppercase">
{COPY.label}
</p>
<p className="mt-1 text-base/7 font-light">{COPY.detail}</p>
</div>
</div>
<a
href="#"
className={cn(
buttonVariants(),
"h-11 bg-white px-5 text-slate-950 hover:bg-white/90"
)}
>
{COPY.action}
</a>
</div>
</div>
)
}
Installation
pnpm dlx shadcn@latest add @01orbital/banner-glow-salenpx shadcn@latest add @01orbital/banner-glow-saleyarn dlx shadcn@latest add @01orbital/banner-glow-salebunx --bun shadcn@latest add @01orbital/banner-glow-saleMake it yours
- Its words are in
COPYat the top ofcomponents/blocks/banner/banner-glow-sale/index.tsx: change them there, not in the markup.
Built from
npm: cn. The CLI installs it for you.
Built from these parts. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:
- Button
font-geist-mono
The shadcn parts here are their Base UI versions, and this piece uses Base UI's API. A Radix version you already have won't work with it.
Last updated on