Glow · Newsletter
A newsletter signup in a glow-bordered card lit cyan from below, with an email field and a subscribe button that confirms. Recolor it by changing one CSS variable.
"use client"
import { useId, useState } from "react"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
// The copy: change text here, not in the markup.
const COPY = {
label: "Dispatch",
title: "One glow a week.",
email: "Email",
placeholder: "you@studio.com",
action: "Subscribe",
done: "Subscribed",
confirmation: "You are subscribed",
} as const
/** A newsletter signup in a glow-bordered card, lit cyan from below. Change `--glow` to recolor it. */
export default function BannerGlowNewsletter() {
const emailId = useId()
const [subscribed, setSubscribed] = useState(false)
return (
<div className="relative isolate w-full overflow-hidden rounded-2xl bg-slate-950 text-white [--glow:34_211_238]">
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_center_bottom,rgb(var(--glow)/0.3)_0%,transparent_70%)]"
/>
<div className="relative z-10 p-6 sm:p-8">
<div className="relative rounded-2xl bg-slate-900/80 shadow-[0_0_60px_rgb(var(--glow)/0.25)]">
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 rounded-2xl bg-[linear-gradient(to_bottom_right,rgb(var(--glow)/0.2),rgb(var(--glow)/0.06)_50%,transparent)]"
/>
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 rounded-2xl border border-[rgb(var(--glow)/0.3)] shadow-[inset_0_0_20px_rgb(var(--glow)/0.1)]"
/>
<div className="relative z-10 grid gap-5 p-6 md:grid-cols-[1fr_auto] md:items-center md:p-8">
<div>
<p className="font-mono text-xs tracking-[0.18em] text-white/70 uppercase">
{COPY.label}
</p>
<h2 className="mt-2 text-3xl font-light tracking-tight">
{COPY.title}
</h2>
</div>
<form
className="flex flex-col gap-3 sm:flex-row"
onSubmit={(event) => {
event.preventDefault()
setSubscribed(true)
}}
>
<label htmlFor={emailId} className="sr-only">
{COPY.email}
</label>
<Input
id={emailId}
type="email"
required
placeholder={COPY.placeholder}
className="h-11 border-white/15 bg-slate-950/60 text-white placeholder:text-white/50"
/>
<Button
type="submit"
className="h-11 bg-white px-5 text-slate-950 hover:bg-white/90"
>
{subscribed ? COPY.done : COPY.action}
</Button>
<span role="status" className="sr-only">
{subscribed ? COPY.confirmation : ""}
</span>
</form>
</div>
</div>
</div>
</div>
)
}
Installation
pnpm dlx shadcn@latest add @01orbital/banner-glow-newsletternpx shadcn@latest add @01orbital/banner-glow-newsletteryarn dlx shadcn@latest add @01orbital/banner-glow-newsletterbunx --bun shadcn@latest add @01orbital/banner-glow-newsletterMake it yours
- Its words are in
COPYat the top ofcomponents/blocks/banner/banner-glow-newsletter/index.tsx: change them there, not in the markup.
Built from
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:
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