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.

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

Quality checks

Automated, in a real browser · 4d ago
—

More from Warm Paper Editorial

The whole style →

Ink and Ghost Pill Buttons

Buttons

Quote Card Grid

Testimonials

Terminal Install Chip

Code blocks

Dated Blog Index Table

Lists

Customer Story Logo Cards

Cards

Hairline Chevron Accordion

FAQ