Glass Email Capture Pill
Pill-shaped frosted input (blur 20px) with placeholder text and embedded periwinkle submit button, paired with a separate glass secondary pill button.
Rebuilt from mercury.com/releases in the Twilight Ledger style.
npx shadcn@latest add https://justyoink.it/r/twilight-ledger-0e1ecf/blocks/email-capture-pill.json
Looks exactly like mercury.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/twilight-ledger-0e1ecf/mine/email-capture-pill.json
Restyled to your project: uses your shadcn colours, fonts and radius, so it matches the rest of your app. Layout, type sizes and motion stay as designed.
Usage
Props: placeholder, submitLabel, secondaryLabel, onSubmit(email). Renders standalone on a light surface; the input pill and secondary pill both use 20px backdrop blur.
components/email-capture-pill.tsx
import { useState } from "react"; export default function GlassEmailCapturePill({ placeholder = "Enter your email", submitLabel = "Get updates", secondaryLabel = "View demo", onSubmit, }: { placeholder?: string; submitLabel?: string; secondaryLabel?: string; onSubmit?: (email: string) => void; }) { const [email, setEmail] = useState(""); return ( <div className="bg-surface-light px-6 py-10"> <form className="flex flex-wrap items-center gap-2" onSubmit={(e) => { e.preventDefault(); onSubmit?.(email); }} > <div className="flex w-full max-w-[411px] items-center rounded-pill border border-ink-dark/10 bg-glass-fill p-1 pl-5 backdrop-blur-[20px] transition-colors duration-150 focus-within:border-accent focus-within:bg-white/70 focus-within:ring-2 focus-within:ring-accent/40"> <label htmlFor="glass-email" className="sr-only">Email address</label> <input id="glass-email" type="email" required value={email} onChange={(e) => setEmail(e.target.value)} placeholder={placeholder} className="min-w-0 flex-1 bg-transparent font-sans text-ink-dark outline-none placeholder:text-ink-dark-muted" /> <button type="submit" className="rounded-pill bg-accent px-5 py-2.5 font-sans text-white transition-colors duration-150 hover:bg-[#4a52d6] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink-dark" > {submitLabel} </button> </div> <button type="button" className="h-10 rounded-pill border border-ink-dark/10 bg-glass-fill px-5 font-sans text-ink-dark backdrop-blur-[20px] transition-colors duration-150 hover:bg-white/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent" > {secondaryLabel} </button> </form> </div> ); }import { useState } from "react"; export default function GlassEmailCapturePill({ placeholder = "Enter your email", submitLabel = "Get updates", secondaryLabel = "View demo", onSubmit, }: { placeholder?: string; submitLabel?: string; secondaryLabel?: string; onSubmit?: (email: string) => void; }) { const [email, setEmail] = useState(""); return ( <div className="bg-foreground px-6 py-10"> <form className="flex flex-wrap items-center gap-2" onSubmit={(e) => { e.preventDefault(); onSubmit?.(email); }} > <div className="flex w-full max-w-[411px] items-center rounded-full border border-muted-foreground/10 bg-secondary p-1 pl-5 backdrop-blur-[20px] transition-colors duration-150 focus-within:border-primary focus-within:bg-foreground/70 focus-within:ring-2 focus-within:ring-primary/40"> <label htmlFor="glass-email" className="sr-only">Email address</label> <input id="glass-email" type="email" required value={email} onChange={(e) => setEmail(e.target.value)} placeholder={placeholder} className="min-w-0 flex-1 bg-transparent font-sans text-muted-foreground outline-none placeholder:text-muted-foreground" /> <button type="submit" className="rounded-full bg-primary px-5 py-2.5 font-sans text-primary-foreground transition-colors duration-150 hover:bg-[#4a52d6] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-muted-foreground" > {submitLabel} </button> </div> <button type="button" className="h-10 rounded-full border border-muted-foreground/10 bg-secondary px-5 font-sans text-muted-foreground backdrop-blur-[20px] transition-colors duration-150 hover:bg-foreground/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary" > {secondaryLabel} </button> </form> </div> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: passedNo serious accessibility problems (axe-core): readable contrast, labelled buttons and images.
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: passedStill readable when installed in your theme and switched to dark mode.
- Themeable: not passed1 hard-coded colour (bg-[#4a52d6]). These ignore the theme and break dark mode.
- Animates cleanly: doesn't applyDoesn't animate, so there's nothing to check.