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.

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>
  );
}

Quality checks

Automated, in a real browser · 4d ago
—

More from Obsidian Canvas

The whole style →

Minimal Black Header

Headers & nav bars

Platform Bento Grid

Feature sections

Audience Icon Grid

Feature sections

Sticky-date Changelog Entry

Changelog

Neon Agent Prompt Hero

Heroes

Hairline Triple Feature Strip

Feature sections