Cookie consent
A banner that asks about cookies, with Reject all as easy as Accept all, and a store that saves the choice and holds scripts back until it is given.
Preview
A card in a corner, with Reject all as easy as Accept all. Customise grows it upward into a switch for each category; Cookie settings in the footer opens it again.
Examples
Island
One line at the foot of the page that opens into a panel with a switch for each category. In a column too narrow for one line, it is a card.
Top bar
A bar above the header, in the page’s flow, so it covers nothing: the page makes room for it, and for the switches Customise opens below it.
Installation
Cookie consent
npx shadcn@latest add https://kinoui.com/r/cookie-consent.json- Files
lib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxcomponents/kino/badge.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxcomponents/kino/collapsible.tsxlib/dates.tslib/consent.tsxlib/announce.tscomponents/kino/label.tsxlib/settle.tscomponents/kino/field.tsxlib/grip.tslib/scroll.tslib/panel.tsxlib/choice.tscomponents/kino/switch.tsxlib/cookie-consent-parts.tsxlib/placeholder.tscomponents/kino/skeleton.tsxcomponents/kino/cookie-consent/cookie-consent.tsx- Packages
@ui-sdk/core@ui-sdk/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
Cookie consent island
npx shadcn@latest add https://kinoui.com/r/cookie-consent-island.json- Files
lib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxcomponents/kino/badge.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/dates.tslib/consent.tsxlib/announce.tscomponents/kino/label.tsxlib/settle.tscomponents/kino/field.tsxlib/grip.tslib/scroll.tslib/panel.tsxlib/choice.tscomponents/kino/switch.tsxlib/cookie-consent-parts.tsxlib/island.tslib/placeholder.tscomponents/kino/skeleton.tsxcomponents/kino/cookie-consent-island/cookie-consent-island.tsx- Packages
@ui-sdk/core@ui-sdk/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
Cookie consent bar
npx shadcn@latest add https://kinoui.com/r/cookie-consent-bar.json- Files
lib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxcomponents/kino/badge.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxcomponents/kino/collapsible.tsxlib/dates.tslib/consent.tsxlib/announce.tscomponents/kino/label.tsxlib/settle.tscomponents/kino/field.tsxlib/grip.tslib/scroll.tslib/panel.tsxlib/choice.tscomponents/kino/switch.tsxlib/cookie-consent-parts.tsxlib/popup.tslib/glide.tsxlib/keys.tsxcomponents/kino/kbd.tsxcomponents/kino/tooltip.tsxlib/cut.tsxlib/hero-parts.tsxlib/placeholder.tscomponents/kino/skeleton.tsxcomponents/kino/cookie-consent-bar/cookie-consent-bar.tsx- Packages
@ui-sdk/core@ui-sdk/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
CookieConsent
The Card arrangement. It shows while the consent asks: on a first visit, once a choice has expired, when the categories’ revision changes, and when consent.open() is called. Other props go to its wrapper, which you place with className.
CookieConsentIsland
The Island arrangement. It takes CookieConsent’s props, and its one line.
CookieConsentBar
The Top bar arrangement. It takes CookieConsent’s props. Put it first in the page, above the header.
createConsent
Makes the store every banner, Cookie settings link and gated script reads. Call it once, outside a component.
useConsent
Reads the store in a component: state (unknown on the server, then asking or given), has(id), save(ids) and open(). consent.open alone suits a Cookie settings link.
ConsentGate
Renders its children, such as an analytics script, only while category is on, once the press that granted it has painted.
ConsentScript
Put it in <head>, before Google’s tag: it sets every Consent Mode type to denied, then grants what a saved choice turned on, before the tags load.
CSS variables
Accessibility
- The banner is a region named by its heading, not a dialog: the page behind it stays usable, as GOV.UK’s does. Put it first in the page, so a keyboard reaches it first.
- Reject all is as easy to reach and as prominent as Accept all, and Escape folds the settings without answering.
- Customise moves focus to the first switch and says the settings are shown. Each switch is named by its category and described by what it covers.
- Opened again from a Cookie settings link, the banner takes focus and scrolls into view; once answered, focus goes back to the link.
- Each answer is announced in a status region that exists before it: All cookies accepted, Only necessary cookies kept, or Cookie choices saved. With Global Privacy Control on, Accept all says which categories stay off.
- The Card and the Island sit over the page and can cover what has focus under them. Give the page room at its foot while the banner shows, or use the Top bar, which covers nothing.
For agents
What an agent reads on this example with snapshot(), and the actions it can call with act().
The Agent bridge page sets up snapshot() and act() in your app.