# Banner, cookie notice

- **[Sections](/blocks/)**
- **[Banner](/blocks/banner/)**
- **Banner, cookie notice**

A cookie notice with accept and reject buttons and a link to the policy.

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/banner-cookie
  ```
- **Import**

  ```
  import Block from '@/components/klarhimmel/blocks/banner-cookie';
  ```

Also called

- 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

- **[Footer, simple](/blocks/footer/simple)**
- **[Footer, columns](/blocks/footer/link-columns)**
- **[Footer, centered](/blocks/footer/centered)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import BannerCookie from '@/components/klarhimmel/blocks/banner-cookie';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <BannerCookie props={{
          "text": "Say in a sentence or two what cookies are used for and that the visitor chooses which ones.",
          "accept": "Accept",
          "reject": "Decline optional",
          "policy": {
            "label": "Cookie policy",
            "href": "#cookies"
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## 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.

- **text**: Text, up to 240 characters.
- **accept**: Text, up to 24 characters.
- **reject**: Text, up to 24 characters.
- **policy**: See the type.

[Previous](/blocks/banner/announcement)

[Next](/blocks/banner/cta-bar)
