Overlays & feedback / Toasts & snackbars
Floating Cookie Banner
Small white-ish floating card at bottom-right with 12px text, underlined policy links, close X, outlined pill 'Cookies Settings' and two ink pills for Reject/Accept.
Rebuilt from cursor.com in the Warm Paper Editorial style.
npx shadcn@latest add https://justyoink.it/r/warm-paper-editorial/blocks/cookie-banner.json
Looks exactly like cursor.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/warm-paper-editorial/mine/cookie-banner.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-right cookie card; override `message` and the `onAcceptAll`, `onRejectAll`, `onSettings`, `onDismiss` callbacks. The X and the Decline/Allow buttons hide the banner.
components/cookie-banner.tsx
import { useState } from "react"; type Props = { message?: string; onAcceptAll?: () => void; onRejectAll?: () => void; onSettings?: () => void; onDismiss?: () => void; }; export default function FloatingCookieBanner({ message = "We store small files on your device to remember preferences and measure how the site performs. Choose what you are comfortable with. Details are in our", onAcceptAll, onRejectAll, onSettings, onDismiss, }: Props) { const [open, setOpen] = useState(true); const close = (cb?: () => void) => () => { cb?.(); setOpen(false); }; if (!open) return null; const link = "underline underline-offset-2 text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-ink rounded-xs"; const pill = "rounded-pill px-3.5 py-1.5 text-ui transition-colors duration-hover-color ease-hover-color focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ink"; return ( <aside role="dialog" aria-label="Cookie preferences" className="fixed bottom-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-[528px] rounded-lg border border-hairline bg-surface p-4 shadow-popover animate-fade-in" > <button type="button" aria-label="Dismiss cookie banner" onClick={close(onDismiss)} className="absolute right-3 top-3 grid h-6 w-6 place-items-center rounded-xs text-ink-muted transition-colors duration-hover-color ease-hover-color hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-ink" > <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round"> <path d="M2 2l8 8M10 2l-8 8" /> </svg> </button> <p className="pr-8 text-[12px] leading-[18px] text-ink-muted"> {message} <a href="#" className={link}>Cookie Notice</a>, <a href="#" className={link}>Privacy Terms</a>, and <a href="#" className={link}>Usage Terms</a>. </p> <div className="mt-4 flex flex-wrap items-center gap-2"> <button type="button" onClick={onSettings} className={`${pill} border border-hairline bg-transparent text-ink hover:bg-surface-sunken`}> Manage Choices </button> <div className="ml-auto flex gap-2"> <button type="button" onClick={close(onRejectAll)} className={`${pill} bg-ink text-canvas hover:bg-ink/85`}> Decline All </button> <button type="button" onClick={close(onAcceptAll)} className={`${pill} bg-ink text-canvas hover:bg-ink/85`}> Allow All </button> </div> </div> </aside> ); }import { useState } from "react"; type Props = { message?: string; onAcceptAll?: () => void; onRejectAll?: () => void; onSettings?: () => void; onDismiss?: () => void; }; export default function FloatingCookieBanner({ message = "We store small files on your device to remember preferences and measure how the site performs. Choose what you are comfortable with. Details are in our", onAcceptAll, onRejectAll, onSettings, onDismiss, }: Props) { const [open, setOpen] = useState(true); const close = (cb?: () => void) => () => { cb?.(); setOpen(false); }; if (!open) return null; const link = "underline underline-offset-2 text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-foreground rounded-sm"; const pill = "rounded-full px-3.5 py-1.5 text-warm-ui transition-colors duration-warm-hover-color ease-warm-hover-color focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground"; return ( <aside role="dialog" aria-label="Cookie preferences" className="fixed bottom-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-[528px] rounded-lg border border-border bg-card p-4 shadow-warm-popover animate-warm-fade-in" > <button type="button" aria-label="Dismiss cookie banner" onClick={close(onDismiss)} className="absolute right-3 top-3 grid h-6 w-6 place-items-center rounded-sm text-muted-foreground transition-colors duration-warm-hover-color ease-warm-hover-color hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-foreground" > <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round"> <path d="M2 2l8 8M10 2l-8 8" /> </svg> </button> <p className="pr-8 text-[12px] leading-[18px] text-muted-foreground"> {message} <a href="#" className={link}>Cookie Notice</a>, <a href="#" className={link}>Privacy Terms</a>, and <a href="#" className={link}>Usage Terms</a>. </p> <div className="mt-4 flex flex-wrap items-center gap-2"> <button type="button" onClick={onSettings} className={`${pill} border border-border bg-transparent text-foreground hover:bg-muted`}> Manage Choices </button> <div className="ml-auto flex gap-2"> <button type="button" onClick={close(onRejectAll)} className={`${pill} bg-foreground text-background hover:bg-foreground/85`}> Decline All </button> <button type="button" onClick={close(onAcceptAll)} className={`${pill} bg-foreground text-background hover:bg-foreground/85`}> Allow All </button> </div> </div> </aside> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: not passedElements must meet minimum color contrast ratio thresholds (1 element)
- 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: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.