Overlays & feedback / Toasts & snackbars
Floating Cookie Notice
White 15px-rounded card fixed bottom-left with dark copy, blue 'Cookie Policy' link and a grey Reject / black Accept button pair.
Rebuilt from framer.com in the Obsidian Canvas style.
npx shadcn@latest add https://justyoink.it/r/obsidian-canvas-cc37fa/blocks/cookie-card.json
Looks exactly like framer.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/obsidian-canvas-cc37fa/mine/cookie-card.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: message, linkLabel, linkHref, rejectLabel, acceptLabel and an onChoice callback receiving 'accept' or 'reject'. The card is fixed bottom-left and dismisses itself after either button is clicked.
components/cookie-card.tsx
import { useState } from "react"; export default function FloatingCookieNotice({ message = "Our site stores small files on your device to remember preferences and measure how pages perform. See the details in our", linkLabel = "Privacy Notes", linkHref = "#", rejectLabel = "Decline", acceptLabel = "Allow", onChoice, }: { message?: string; linkLabel?: string; linkHref?: string; rejectLabel?: string; acceptLabel?: string; onChoice?: (choice: "accept" | "reject") => void; }) { const [open, setOpen] = useState(true); const choose = (c: "accept" | "reject") => { onChoice?.(c); setOpen(false); }; if (!open) return null; return ( <aside role="dialog" aria-label="Cookie notice" className="fixed bottom-5 left-5 z-50 w-[calc(100%-2.5rem)] max-w-[340px] rounded-[15px] bg-inverse-surface p-5 text-[#111] shadow-[0_8px_30px_rgba(0,0,0,0.5)] transition-opacity duration-fade-in-load ease-fade-in-load" > <p className="text-[14px] leading-[21px] text-[#1a1a1a]"> {message}{" "} <a href={linkHref} className="text-[#0099ff] hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#0099ff]" > {linkLabel} </a> . </p> <div className="mt-5 flex gap-2.5"> <button type="button" onClick={() => choose("reject")} className="h-9 flex-1 rounded-lg bg-[#e0e0e0] text-[14px] font-medium text-[#111] transition-colors duration-surface-hover hover:bg-[#cfcfcf] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#0099ff]" > {rejectLabel} </button> <button type="button" onClick={() => choose("accept")} className="h-9 flex-1 rounded-lg bg-black text-[14px] font-medium text-white transition-colors duration-surface-hover hover:bg-[#2a2a2a] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#0099ff]" > {acceptLabel} </button> </div> </aside> ); }import { useState } from "react"; export default function FloatingCookieNotice({ message = "Our site stores small files on your device to remember preferences and measure how pages perform. See the details in our", linkLabel = "Privacy Notes", linkHref = "#", rejectLabel = "Decline", acceptLabel = "Allow", onChoice, }: { message?: string; linkLabel?: string; linkHref?: string; rejectLabel?: string; acceptLabel?: string; onChoice?: (choice: "accept" | "reject") => void; }) { const [open, setOpen] = useState(true); const choose = (c: "accept" | "reject") => { onChoice?.(c); setOpen(false); }; if (!open) return null; return ( <aside role="dialog" aria-label="Cookie notice" className="fixed bottom-5 left-5 z-50 w-[calc(100%-2.5rem)] max-w-[340px] rounded-[15px] bg-primary p-5 text-card shadow-[0_8px_30px_rgba(0,0,0,0.5)] transition-opacity duration-obsidian-fade-in-load ease-obsidian-fade-in-load" > <p className="text-[14px] leading-[21px] text-[#1a1a1a]"> {message}{" "} <a href={linkHref} className="text-primary hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary" > {linkLabel} </a> . </p> <div className="mt-5 flex gap-2.5"> <button type="button" onClick={() => choose("reject")} className="h-9 flex-1 rounded-xl bg-[#e0e0e0] text-[14px] font-medium text-card transition-colors duration-obsidian-surface-hover hover:bg-[#cfcfcf] focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary" > {rejectLabel} </button> <button type="button" onClick={() => choose("accept")} className="h-9 flex-1 rounded-xl bg-background text-[14px] font-medium text-foreground transition-colors duration-obsidian-surface-hover hover:bg-[#2a2a2a] focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary" > {acceptLabel} </button> </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: not passed4 hard-coded colours (text-[#1a1a1a], bg-[#e0e0e0], bg-[#cfcfcf], bg-[#2a2a2a]). These ignore the theme and break dark mode.
- Animates cleanly: doesn't applyDoesn't animate, so there's nothing to check.