Cookie consent
Asks once what the site may store: Customize, Reject all or Accept all.
We use essential cookies to run this site. With your OK, we'd also use optional ones to remember settings and learn what helps.
Installation
npm i @uisatin/uiimport { CookieConsent } from '@uisatin/ui/cookie-consent'About 15.0 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.
npx shadcn@latest add https://uisatin.dev/r/cookie-consent.jsonAdds cookie-consent.tsx, button.tsx, labels.tsx and spinner.tsx to components/ui.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The CookieConsent component is a card that asks what the site may store: the message, then Customize, Reject all and Accept all. It is a labelled region, not a modal.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
onAccept | () => void | — |
onReject | () => void | — |
onCustomize | () => void | — |
acceptLabel | string | "Accept all" |
rejectLabel | string | "Reject all" |
customizeLabel | string | "Customize" |
floating | boolean | false |
className | string | — |
ref | Ref<HTMLElement> | — |
...props | ComponentProps<'section'>Other attributes go to <section> | — |
Accessibility
A section named "Cookie consent" (aria-label overrides it), so it is a region landmark. It is not a modal and not a live region: focus stays where it was and the page stays usable. The answers are native buttons.
Something wrong or missing on this page?
Report a problemSuggest an improvement