Banner, cookie notice


Install
npx shadcn add @klarhimmel/banner-cookieDetailsAbout, usage, props and more
A cookie notice with accept and reject buttons and a link to the policy.
Import
Import
- banner/cookie
- Category
- Announcement bars and the cookie notice. New project? Set it up once: /get-started/installation.
Notes
When to use it
A consent notice with two buttons and a link to the policy, placed at the foot of the page. It is for consent only; use banner-announcement for news and banner-cta-bar for a closing nudge.
Writing for it
- The text field holds 240 characters, enough for two plain sentences about what the cookies do. Name the purpose rather than saying we value your privacy. - Accept and reject are both required and capped at 24 characters. Keep them the same length and weight so neither choice looks like the preferred one. - The policy link is a single link field; fill it, because the sentence ends right before the link label.
Watch out for
Both buttons only close the notice in component state. The block does not set a cookie, record a choice or switch any script on or off, so the host page has to wire that up itself.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | 'Say in a sentence or two what cooki…' | Text, up to 240 characters. |
accept | string | 'Accept' | Text, up to 24 characters. |
reject | string | 'Decline optional' | Text, up to 24 characters. |
policy | Link | {…} | See the type. |