Buttons & actions / Floating buttons
Warning Triangle Cookie Badge
Fixed bottom-left yellow triangular sign with a black hand icon and tiny 'cookie control' caption, evoking a hazard label.
Rebuilt from teenage.engineering/newsletter in the Embossed Lab Monochrome style.
npx shadcn@latest add https://justyoink.it/r/embossed-lab-monochrome/blocks/cookie-warning-badge.json
Looks exactly like teenage.engineering: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/embossed-lab-monochrome/mine/cookie-warning-badge.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
Renders a fixed bottom-left yellow hazard-style triangle; clicking opens a small preferences dialog. Props: label (caption), title and description (dialog copy). Works with no props.
components/cookie-warning-badge.tsx
import { useState } from "react"; export default function WarningTriangleCookieBadge({ label = "cookie control", title = "cookie preferences", description = "we use a few small files to remember your settings and measure what works.", }: { label?: string; title?: string; description?: string; }) { const [open, setOpen] = useState(false); const [analytics, setAnalytics] = useState(true); return ( <div className="font-sans"> <button type="button" aria-label="Open cookie preferences" aria-haspopup="dialog" aria-expanded={open} onClick={() => setOpen(true)} className="fixed bottom-4 left-3 z-40 h-[68px] w-[78px] origin-bottom transition-transform duration-tile-hover ease-tile-hover hover:scale-110 focus-visible:scale-110 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-ink motion-reduce:transition-none" > <svg viewBox="0 0 78 68" className="absolute inset-0 h-full w-full" aria-hidden="true"> <path d="M39 2 Q41 2 43 5 L75 62 Q77 66 72 66 L6 66 Q1 66 3 62 L35 5 Q37 2 39 2Z" className="fill-accent-yellow" /> </svg> <svg viewBox="0 0 24 24" className="absolute left-1/2 top-[20px] h-7 w-7 -translate-x-1/2 text-ink" aria-hidden="true"> <path fill="currentColor" d="M8 22c-2-3-3-5-4-8-.5-1.5 1-2 2-.8L7.5 15V6c0-1 1.5-1 1.5 0v5h.5V4c0-1 1.5-1 1.5 0v7h.5V5c0-1 1.5-1 1.5 0v6h.5V7c0-1 1.5-1 1.5 0v8c0 3-1 5-2 7z" /> </svg> <span className="absolute inset-x-0 bottom-[7px] text-center text-[7px] leading-[8px] text-ink"> {label.split(" ").map((w) => ( <span key={w} className="block">{w}</span> ))} </span> </button> {open && ( <div className="fixed inset-0 z-50 flex items-end bg-ink/40 p-4 sm:items-center sm:justify-center" onClick={() => setOpen(false)}> <div role="dialog" aria-modal="true" aria-label={title} onClick={(e) => e.stopPropagation()} className="w-full max-w-sm bg-canvas p-6 text-on-dark animate-fade-in" > <h2 className="font-display text-2xl font-light">{title}</h2> <p className="mt-2 text-sm font-light text-on-dark/70">{description}</p> <label className="mt-5 flex items-center gap-3 text-sm font-light"> <input type="checkbox" checked={analytics} onChange={(e) => setAnalytics(e.target.checked)} className="h-4 w-4 accent-[#f7b928]" /> analytics </label> <button type="button" onClick={() => setOpen(false)} className="mt-6 w-full bg-white py-3 text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-yellow" > save </button> </div> </div> )} </div> ); }import { useState } from "react"; export default function WarningTriangleCookieBadge({ label = "cookie control", title = "cookie preferences", description = "we use a few small files to remember your settings and measure what works.", }: { label?: string; title?: string; description?: string; }) { const [open, setOpen] = useState(false); const [analytics, setAnalytics] = useState(true); return ( <div className="font-mono"> <button type="button" aria-label="Open cookie preferences" aria-haspopup="dialog" aria-expanded={open} onClick={() => setOpen(true)} className="fixed bottom-4 left-3 z-40 h-[68px] w-[78px] origin-bottom transition-transform duration-embossed-tile-hover ease-embossed-tile-hover hover:scale-110 focus-visible:scale-110 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-foreground motion-reduce:transition-none" > <svg viewBox="0 0 78 68" className="absolute inset-0 h-full w-full" aria-hidden="true"> <path d="M39 2 Q41 2 43 5 L75 62 Q77 66 72 66 L6 66 Q1 66 3 62 L35 5 Q37 2 39 2Z" className="fill-embossed-accent-yellow" /> </svg> <svg viewBox="0 0 24 24" className="absolute left-1/2 top-[20px] h-7 w-7 -translate-x-1/2 text-foreground" aria-hidden="true"> <path fill="currentColor" d="M8 22c-2-3-3-5-4-8-.5-1.5 1-2 2-.8L7.5 15V6c0-1 1.5-1 1.5 0v5h.5V4c0-1 1.5-1 1.5 0v7h.5V5c0-1 1.5-1 1.5 0v6h.5V7c0-1 1.5-1 1.5 0v8c0 3-1 5-2 7z" /> </svg> <span className="absolute inset-x-0 bottom-[7px] text-center text-[7px] leading-[8px] text-foreground"> {label.split(" ").map((w) => ( <span key={w} className="block">{w}</span> ))} </span> </button> {open && ( <div className="fixed inset-0 z-50 flex items-end bg-foreground/40 p-4 sm:items-center sm:justify-center" onClick={() => setOpen(false)}> <div role="dialog" aria-modal="true" aria-label={title} onClick={(e) => e.stopPropagation()} className="w-full max-w-sm bg-background p-6 text-foreground animate-embossed-fade-in" > <h2 className="font-mono text-2xl font-light">{title}</h2> <p className="mt-2 text-sm font-light text-foreground/70">{description}</p> <label className="mt-5 flex items-center gap-3 text-sm font-light"> <input type="checkbox" checked={analytics} onChange={(e) => setAnalytics(e.target.checked)} className="h-4 w-4 accent-[#f7b928]" /> analytics </label> <button type="button" onClick={() => setOpen(false)} className="mt-6 w-full bg-foreground py-3 text-background focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-embossed-accent-yellow" > save </button> </div> </div> )} </div> ); }
Quality checks
Automated, in a real browser · today- 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 (accent-[#f7b928]). These ignore the theme and break dark mode.
- Animates cleanly: doesn't applyDoesn't animate, so there's nothing to check.