Dot Cookies
Accept and a bite comes out of the biscuit, crumbs flying; reject and it's simply put away; choose and each kind of cookie gets its own switch. Reject all sits right beside Accept all, the same weight. The choice is remembered so it stays away, and a Cookie settings link can open it again.
Needs: None. One small canvas and localStorage.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| categories | { id; label; description?; required? }[] | "necessary, analytics, marketing" | The kinds of cookie. Required ones are always on. |
| title | string | "Cookies" | Its heading. |
| children | ReactNode | – | What it says. A plain default if left out. |
| policyHref | string | – | Where your cookie policy lives. |
| policyLabel | string | "Cookie policy" | The policy link's words. |
| onDecide | (choices: Record<string, boolean>) => void | – | Called with what was agreed to. |
| storageKey | string | null | "mlui-consent" | Where the choice is remembered. null: ask every time. |
| open | boolean | – | Show it whatever's remembered, for a Cookie settings link. |
| position | "bottom-left" | "bottom-right" | "inline" | "bottom-left" | Pinned to a corner of the window, or in the page. |
| className | string | – | Class on the banner. |
| style | CSSProperties | – | Style on the banner. |