Skip to content
synccn

Cookie Consent

New

Cookie banner with accept, reject and per-category choices.

Installation

$ pnpm dlx shadcn@latest add @synccn/cookie-consent

First time in this project? Connect synccn with one command.

Usage

import { CookieConsent } from "@/components/ui/cookie-consent";<CookieConsent position="fixed" onSave={store} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

CookieConsent

Cookie banner with Accept all, Reject all and a Customise view. onSave receives { necessary, analytics, marketing }. Store the choice yourself.

  • onSave
    (prefs: CookiePreferences) => void

    Called with the visitor's choices. Store them yourself.

  • policyHref
    string

    Default "#"

    Link to your cookie policy.

  • position
    "inline" | "fixed"

    Default "inline"

    Fixed pins it to the bottom-left of the screen.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Components

Helpers

npm packages

Accessibility

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: dialog
  • ARIA attributes: aria-label