
# Banner



> Banner component displays important information to the user. The importance of the message can be highlighted with colors.

## Examples

### Default

```tsx
import { Banner } from "@kesko/components";

export default () => (
  <Banner>
    Weekend home delivery slots fill up early. <a href="#">Book a delivery time</a>.
  </Banner>
);

```

```html
<k-banner>
  <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M13.162 7.39c0 .65-.495 1.147-1.162 1.147s-1.163-.495-1.163-1.147.496-1.147 1.163-1.147 1.163.48 1.163 1.147zm-.512 2.295l-1.347.202c-.17.03-.248.14-.248.325v6.525a.25.25 0 0 0 .263.263h1.364a.25.25 0 0 0 .263-.263V9.902c0-.17-.108-.247-.295-.217zm7.375-3.643a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
  <div class="k-banner-body">Weekend home delivery slots fill up early. <a href="#">Book a delivery time</a>.</div>
</k-banner>
```

### Custom icon

```tsx
import { Banner } from "@kesko/components";
import { IconHeart } from "@kesko/iconography/react";

export default () => (
  <Banner icon={<IconHeart />}>
    Thank you for shopping at K-Rauta. Your K-Plussa points have been added.
  </Banner>
);

```

```html
<k-banner>
  <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.852 4.673c-2.432-2.265-6.365-2.153-8.767.25l-.083.082-.082-.082c-2.402-2.403-6.338-2.515-8.768-.25C.595 7.053.52 11.196 2.99 13.667l8.307 8.31c.39.39 1.025.39 1.415 0l8.308-8.307c2.471-2.471 2.396-6.615-.163-8.995zm-.897 7.937L12 20.565 4.045 12.61c-1.881-1.881-1.816-5.027.125-6.84 1.845-1.72 4.845-1.625 6.685.215l.862.863c.155.155.41.155.565 0l.863-.863c1.84-1.837 4.837-1.935 6.685-.215 1.941 1.809 2.007 4.96.125 6.837z" fill="currentColor" /></svg></span>
  <div class="k-banner-body">Thank you for shopping at K-Rauta. Your K-Plussa points have been added.</div>
</k-banner>
```

### Dismissible

```tsx
import { useState } from "react";
import { Banner, Button } from "@kesko/components";

export default () => {
  const [open, setOpen] = useState(true);

  if (!open) {
    return (
      <Button appearance="outline" onClick={() => setOpen(true)}>
        Show banner
      </Button>
    );
  }

  return (
    <Banner variant="secondary" dismissible onDismiss={() => setOpen(false)}>
      Pick a store to see local prices and availability. <a href="#">Choose your store</a>.
    </Banner>
  );
};

```

```html
<k-banner variant="secondary">
  <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M13.162 7.39c0 .65-.495 1.147-1.162 1.147s-1.163-.495-1.163-1.147.496-1.147 1.163-1.147 1.163.48 1.163 1.147zm-.512 2.295l-1.347.202c-.17.03-.248.14-.248.325v6.525a.25.25 0 0 0 .263.263h1.364a.25.25 0 0 0 .263-.263V9.902c0-.17-.108-.247-.295-.217zm7.375-3.643a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
  <div class="k-banner-body">Pick a store to see local prices and availability. <a href="#">Choose your store</a>.</div>
  <button class="k-button" size="sm" appearance="plain" square aria-label="Close">
    <svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.247 19.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-7.188 7.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 3.752 4.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l7.187-7.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
  </button>
</k-banner>
```

### Heading and actions

```tsx
import { useState } from "react";
import { Banner, Button, Stack } from "@kesko/components";

export default () => {
  const [open, setOpen] = useState(true);

  if (!open) {
    return (
      <Button appearance="outline" onClick={() => setOpen(true)}>
        Show banner
      </Button>
    );
  }

  return (
    <Banner variant="success" dismissible onDismiss={() => setOpen(false)}>
      <h3>Delivery confirmed</h3>
      <p>Your K-Ruoka order will be delivered on Friday between 16:00 and 18:00.</p>
      <Stack>
        <Button>Track delivery</Button>
        <Button appearance="outline">Edit order</Button>
      </Stack>
    </Banner>
  );
};

```

```html
<k-banner variant="success">
  <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 8.182a.4.4 0 0 1 .055.563l-5.728 6.98a.748.748 0 0 1-.554.275h-.025a.745.745 0 0 1-.545-.235l-3.725-3.958a.397.397 0 0 1 .017-.564l.51-.48a.397.397 0 0 1 .565.017l3.14 3.338 5.185-6.32a.4.4 0 0 1 .563-.055l.54.445zm2.525-2.14a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
  <div class="k-banner-body">
    <h3>Delivery confirmed</h3>
    <p>Your K-Ruoka order will be delivered on Friday between 16:00 and 18:00.</p>
    <k-stack>
      <button class="k-button">Track delivery</button>
      <button class="k-button" appearance="outline">Edit order</button>
    </k-stack>
  </div>
  <button class="k-button" size="sm" appearance="plain" square aria-label="Close">
    <svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.247 19.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-7.188 7.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 3.752 4.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l7.187-7.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
  </button>
</k-banner>
```

### Live region

```tsx
import { useState } from "react";
import { Banner, Button, Stack } from "@kesko/components";

export default () => {
  const [saved, setSaved] = useState(false);

  return (
    <Stack>
      <Button onClick={() => setSaved(true)}>Save list</Button>
      <div role="status">
        {saved && (
          <Banner variant="success" dismissible onDismiss={() => setSaved(false)}>
            Your shopping list has been saved.
          </Banner>
        )}
      </div>
    </Stack>
  );
};

```

```html
<k-stack>
  <button class="k-button">Save list</button>
  <div role="status">
    <k-banner variant="success">
      <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 8.182a.4.4 0 0 1 .055.563l-5.728 6.98a.748.748 0 0 1-.554.275h-.025a.745.745 0 0 1-.545-.235l-3.725-3.958a.397.397 0 0 1 .017-.564l.51-.48a.397.397 0 0 1 .565.017l3.14 3.338 5.185-6.32a.4.4 0 0 1 .563-.055l.54.445zm2.525-2.14a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
      <div class="k-banner-body">Your shopping list has been saved.</div>
      <button class="k-button" size="sm" appearance="plain" square aria-label="Close">
      <svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.247 19.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-7.188 7.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 3.752 4.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l7.187-7.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
    </button>
    </k-banner>
  </div>
</k-stack>
```

### Variants

```tsx
import { Banner, Stack } from "@kesko/components";

export default () => (
  <Stack>
    <Banner variant="primary">
      Weekend home delivery slots fill up early. <a href="#">Book a delivery time</a>.
    </Banner>
    <Banner variant="secondary">
      Your K-Ruoka order can still be edited until 22:00 tonight. <a href="#">Edit order</a>.
    </Banner>
    <Banner variant="success">
      Your order is packed and ready for pickup at K-Citymarket Sello. <a href="#">Show pickup code</a>.
    </Banner>
    <Banner variant="warning">
      Your payment card expires this month. To keep home delivery running, <a href="#">update your card</a>.
    </Banner>
    <Banner variant="error">
      We couldn’t load stock levels for your store. <a href="#">Try again</a> or check back in a few minutes.
    </Banner>
    <Banner variant="neutral">
      Prices include VAT. Delivery fees are shown at checkout. <a href="#">See delivery fees</a>.
    </Banner>
  </Stack>
);

```

```html
<k-stack>
  <k-banner>
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M13.162 7.39c0 .65-.495 1.147-1.162 1.147s-1.163-.495-1.163-1.147.496-1.147 1.163-1.147 1.163.48 1.163 1.147zm-.512 2.295l-1.347.202c-.17.03-.248.14-.248.325v6.525a.25.25 0 0 0 .263.263h1.364a.25.25 0 0 0 .263-.263V9.902c0-.17-.108-.247-.295-.217zm7.375-3.643a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">Weekend home delivery slots fill up early. <a href="#">Book a delivery time</a>.</div>
  </k-banner>
  <k-banner variant="secondary">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M13.162 7.39c0 .65-.495 1.147-1.162 1.147s-1.163-.495-1.163-1.147.496-1.147 1.163-1.147 1.163.48 1.163 1.147zm-.512 2.295l-1.347.202c-.17.03-.248.14-.248.325v6.525a.25.25 0 0 0 .263.263h1.364a.25.25 0 0 0 .263-.263V9.902c0-.17-.108-.247-.295-.217zm7.375-3.643a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">Your K-Ruoka order can still be edited until 22:00 tonight. <a href="#">Edit order</a>.</div>
  </k-banner>
  <k-banner variant="success">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 8.182a.4.4 0 0 1 .055.563l-5.728 6.98a.748.748 0 0 1-.554.275h-.025a.745.745 0 0 1-.545-.235l-3.725-3.958a.397.397 0 0 1 .017-.564l.51-.48a.397.397 0 0 1 .565.017l3.14 3.338 5.185-6.32a.4.4 0 0 1 .563-.055l.54.445zm2.525-2.14a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">Your order is packed and ready for pickup at K-Citymarket Sello. <a href="#">Show pickup code</a>.</div>
  </k-banner>
  <k-banner variant="warning">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M10.77 15.947c0-.664.495-1.187 1.23-1.187s1.23.522 1.23 1.188-.495 1.2-1.23 1.2-1.23-.523-1.23-1.2zm.877-2.612l.75-.128c.183-.027.255-.14.255-.297l.368-5.665a.23.23 0 0 0-.24-.24h-1.555c-.14 0-.24.1-.24.24l.383 5.878c.014.17.127.24.282.212zm8.378-7.293a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">Your payment card expires this month. To keep home delivery running, <a href="#">update your card</a>.</div>
  </k-banner>
  <k-banner variant="error">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M22.113 18.023L13.745 3.08c-.75-1.343-2.738-1.338-3.49 0L1.888 18.023C1.153 19.332 2.13 21 3.633 21h16.735c1.503 0 2.476-1.666 1.745-2.978zM20.367 19.5H3.633a.504.504 0 0 1-.435-.745l8.364-14.94a.506.506 0 0 1 .875 0l8.368 14.942a.501.501 0 0 1-.438.743zm-8.885-5.66l-.31-4.785c0-.115.08-.195.194-.195h1.265c.116 0 .196.08.196.195l-.3 4.613c0 .127-.058.217-.208.242l-.61.102c-.128.023-.217-.035-.23-.172zM13 16.14c0 .552-.403.978-1 .978s-1-.425-1-.978.403-.965 1-.965 1 .425 1 .965z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">We couldn’t load stock levels for your store. <a href="#">Try again</a> or check back in a few minutes.</div>
  </k-banner>
  <k-banner variant="neutral">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M13.162 7.39c0 .65-.495 1.147-1.162 1.147s-1.163-.495-1.163-1.147.496-1.147 1.163-1.147 1.163.48 1.163 1.147zm-.512 2.295l-1.347.202c-.17.03-.248.14-.248.325v6.525a.25.25 0 0 0 .263.263h1.364a.25.25 0 0 0 .263-.263V9.902c0-.17-.108-.247-.295-.217zm7.375-3.643a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">Prices include VAT. Delivery fees are shown at checkout. <a href="#">See delivery fees</a>.</div>
  </k-banner>
</k-stack>
```

### Variants with heading and actions

```tsx
import { Banner, Button, Stack } from "@kesko/components";

export default () => (
  <Stack>
    <Banner variant="primary" dismissible>
      <h3>Delivery slots filling up</h3>
      <p>Weekend home delivery slots for your area are almost full.</p>
      <Stack>
        <Button>Book a delivery time</Button>
        <Button appearance="outline">View pickup options</Button>
      </Stack>
    </Banner>
    <Banner variant="secondary" dismissible>
      <h3>Order still editable</h3>
      <p>You can add or remove items from your K-Ruoka order until 22:00 tonight.</p>
      <Stack>
        <Button>Edit order</Button>
        <Button appearance="outline">View order</Button>
      </Stack>
    </Banner>
    <Banner variant="success" dismissible>
      <h3>Delivery confirmed</h3>
      <p>Your K-Ruoka order will be delivered on Friday between 16:00 and 18:00.</p>
      <Stack>
        <Button>Track delivery</Button>
        <Button appearance="outline">Edit order</Button>
      </Stack>
    </Banner>
    <Banner variant="warning" dismissible>
      <h3>Payment card expiring</h3>
      <p>Your card expires this month. Update it to keep home delivery running.</p>
      <Stack>
        <Button>Update card</Button>
        <Button appearance="outline">Remind me later</Button>
      </Stack>
    </Banner>
    <Banner variant="error" dismissible>
      <h3>Stock levels unavailable</h3>
      <p>We couldn’t load stock levels for your store. Prices may be out of date.</p>
      <Stack>
        <Button>Try again</Button>
        <Button appearance="outline">Change store</Button>
      </Stack>
    </Banner>
    <Banner variant="neutral" dismissible>
      <h3>Closed on Midsummer Day</h3>
      <p>All K-Rauta stores are closed on Saturday. Online orders ship again on Monday.</p>
      <Stack>
        <Button>See opening hours</Button>
        <Button appearance="outline">Find a store</Button>
      </Stack>
    </Banner>
  </Stack>
);

```

```html
<k-stack>
  <k-banner>
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M13.162 7.39c0 .65-.495 1.147-1.162 1.147s-1.163-.495-1.163-1.147.496-1.147 1.163-1.147 1.163.48 1.163 1.147zm-.512 2.295l-1.347.202c-.17.03-.248.14-.248.325v6.525a.25.25 0 0 0 .263.263h1.364a.25.25 0 0 0 .263-.263V9.902c0-.17-.108-.247-.295-.217zm7.375-3.643a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">
      <h3>Delivery slots filling up</h3>
      <p>Weekend home delivery slots for your area are almost full.</p>
      <k-stack>
        <button class="k-button">Book a delivery time</button>
        <button class="k-button" appearance="outline">View pickup options</button>
      </k-stack>
    </div>
    <button class="k-button" size="sm" appearance="plain" square aria-label="Close">
      <svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.247 19.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-7.188 7.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 3.752 4.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l7.187-7.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
    </button>
  </k-banner>
  <k-banner variant="secondary">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M13.162 7.39c0 .65-.495 1.147-1.162 1.147s-1.163-.495-1.163-1.147.496-1.147 1.163-1.147 1.163.48 1.163 1.147zm-.512 2.295l-1.347.202c-.17.03-.248.14-.248.325v6.525a.25.25 0 0 0 .263.263h1.364a.25.25 0 0 0 .263-.263V9.902c0-.17-.108-.247-.295-.217zm7.375-3.643a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">
      <h3>Order still editable</h3>
      <p>You can add or remove items from your K-Ruoka order until 22:00 tonight.</p>
      <k-stack>
        <button class="k-button">Edit order</button>
        <button class="k-button" appearance="outline">View order</button>
      </k-stack>
    </div>
    <button class="k-button" size="sm" appearance="plain" square aria-label="Close">
      <svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.247 19.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-7.188 7.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 3.752 4.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l7.187-7.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
    </button>
  </k-banner>
  <k-banner variant="success">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 8.182a.4.4 0 0 1 .055.563l-5.728 6.98a.748.748 0 0 1-.554.275h-.025a.745.745 0 0 1-.545-.235l-3.725-3.958a.397.397 0 0 1 .017-.564l.51-.48a.397.397 0 0 1 .565.017l3.14 3.338 5.185-6.32a.4.4 0 0 1 .563-.055l.54.445zm2.525-2.14a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">
      <h3>Delivery confirmed</h3>
      <p>Your K-Ruoka order will be delivered on Friday between 16:00 and 18:00.</p>
      <k-stack>
        <button class="k-button">Track delivery</button>
        <button class="k-button" appearance="outline">Edit order</button>
      </k-stack>
    </div>
    <button class="k-button" size="sm" appearance="plain" square aria-label="Close">
      <svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.247 19.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-7.188 7.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 3.752 4.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l7.187-7.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
    </button>
  </k-banner>
  <k-banner variant="warning">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M10.77 15.947c0-.664.495-1.187 1.23-1.187s1.23.522 1.23 1.188-.495 1.2-1.23 1.2-1.23-.523-1.23-1.2zm.877-2.612l.75-.128c.183-.027.255-.14.255-.297l.368-5.665a.23.23 0 0 0-.24-.24h-1.555c-.14 0-.24.1-.24.24l.383 5.878c.014.17.127.24.282.212zm8.378-7.293a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">
      <h3>Payment card expiring</h3>
      <p>Your card expires this month. Update it to keep home delivery running.</p>
      <k-stack>
        <button class="k-button">Update card</button>
        <button class="k-button" appearance="outline">Remind me later</button>
      </k-stack>
    </div>
    <button class="k-button" size="sm" appearance="plain" square aria-label="Close">
      <svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.247 19.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-7.188 7.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 3.752 4.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l7.187-7.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
    </button>
  </k-banner>
  <k-banner variant="error">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M22.113 18.023L13.745 3.08c-.75-1.343-2.738-1.338-3.49 0L1.888 18.023C1.153 19.332 2.13 21 3.633 21h16.735c1.503 0 2.476-1.666 1.745-2.978zM20.367 19.5H3.633a.504.504 0 0 1-.435-.745l8.364-14.94a.506.506 0 0 1 .875 0l8.368 14.942a.501.501 0 0 1-.438.743zm-8.885-5.66l-.31-4.785c0-.115.08-.195.194-.195h1.265c.116 0 .196.08.196.195l-.3 4.613c0 .127-.058.217-.208.242l-.61.102c-.128.023-.217-.035-.23-.172zM13 16.14c0 .552-.403.978-1 .978s-1-.425-1-.978.403-.965 1-.965 1 .425 1 .965z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">
      <h3>Stock levels unavailable</h3>
      <p>We couldn’t load stock levels for your store. Prices may be out of date.</p>
      <k-stack>
        <button class="k-button">Try again</button>
        <button class="k-button" appearance="outline">Change store</button>
      </k-stack>
    </div>
    <button class="k-button" size="sm" appearance="plain" square aria-label="Close">
      <svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.247 19.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-7.188 7.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 3.752 4.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l7.187-7.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
    </button>
  </k-banner>
  <k-banner variant="neutral">
    <span class="k-banner-icon"><svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M13.162 7.39c0 .65-.495 1.147-1.162 1.147s-1.163-.495-1.163-1.147.496-1.147 1.163-1.147 1.163.48 1.163 1.147zm-.512 2.295l-1.347.202c-.17.03-.248.14-.248.325v6.525a.25.25 0 0 0 .263.263h1.364a.25.25 0 0 0 .263-.263V9.902c0-.17-.108-.247-.295-.217zm7.375-3.643a.396.396 0 0 0-.603-.047l-.505.505a.399.399 0 0 0-.035.52 8.45 8.45 0 0 1 1.62 4.982c0 4.688-3.812 8.5-8.5 8.5S3.5 16.687 3.5 12 7.313 3.5 12 3.5c1.86 0 3.58.602 4.983 1.62.16.117.38.105.52-.035l.505-.505a.4.4 0 0 0-.048-.603A9.945 9.945 0 0 0 12 2.002c-5.515 0-10 4.485-10 10s4.485 10 10 10 10-4.485 10-10c0-2.23-.735-4.292-1.975-5.957z" fill="currentColor" /></svg></span>
    <div class="k-banner-body">
      <h3>Closed on Midsummer Day</h3>
      <p>All K-Rauta stores are closed on Saturday. Online orders ship again on Monday.</p>
      <k-stack>
        <button class="k-button">See opening hours</button>
        <button class="k-button" appearance="outline">Find a store</button>
      </k-stack>
    </div>
    <button class="k-button" size="sm" appearance="plain" square aria-label="Close">
      <svg viewBox="0 0 24 24" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20.247 19.188a.401.401 0 0 1 0 .565l-.495.495a.401.401 0 0 1-.565 0L12 13.06l-7.188 7.188a.401.401 0 0 1-.565 0l-.495-.495a.401.401 0 0 1 0-.565L10.94 12 3.752 4.812a.401.401 0 0 1 0-.565l.495-.494a.401.401 0 0 1 .565 0L12 10.94l7.187-7.187a.401.401 0 0 1 .565 0l.495.495a.401.401 0 0 1 0 .565L13.06 12z" fill="currentColor" /></svg>
    </button>
  </k-banner>
</k-stack>
```


## Props

- `variant` — `"primary" | "secondary" | "success" | "warning" | "error" | "neutral"` (default: `"primary"`) The style variant of the banner.
- `icon` — `ReactNode | false` The leading icon. Each variant has a default; pass an icon element to replace it, or `false` to render the banner without one.
- `dismissible` — `boolean` (default: `false`) Renders a close button at the end of the banner. The banner does not remove itself: handle `onDismiss` and stop rendering it.

## Events

- `onDismiss` — `(event: MouseEvent<HTMLButtonElement>) => void` Called when the close button is activated.

## CSS custom properties

- `--k-banner-radius` (default: `var(--k-radius-md)`) Overrides the border radius.
- `--k-banner-shadow` (default: `none`) Overrides the box shadow.
- `--k-banner-bg` (default: `var(--k-color-bg-primary)`) Overrides the background color.
- `--k-banner-border` (default: `var(--k-color-border-primary)`) Overrides the border color.
- `--k-banner-text` (default: `light-dark(var(--k-color-theme-primary-hover), var(--k-color-text-base))`) Overrides the text and icon color.

## Accessibility

Banner is built on a `<k-banner>` element holding your content, so headings, links and buttons inside it keep their native semantics.

- **Decide whether it is a live region.** A banner that is part of the page when it loads needs no role. When you insert one after an action, render it inside an element that already has `role="status"`, so screen readers announce it without interrupting, or `role="alert"` for an error that blocks the workflow. A region that appears together with its content is often not announced.
- **Keep the meaning in the words.** The variant colors the message for people who see them. The text has to carry the meaning for everyone: say “Payment failed” rather than relying on the red.
- **Pick the heading level from the page outline.** Every level from `h1` to `h6` looks the same inside the banner, so choose the one that follows the heading above the banner. The examples use `h3` only because they sit under an `h2`.
- **Say what to do next.** Link the fix or the details inside the message, or add action buttons, so people do not have to look for them.
- **Close is named for you.** The close button is called “Sulje” and follows the language like the other built-in text. Handle `onDismiss` and stop rendering the banner; the component does not hide itself.
- **Check contrast if you override colors.** `--k-banner-text` needs 4.5:1 against `--k-banner-bg`, and buttons inside the banner take the banner's colors. Verify with the [WebAIM contrast checker](https://webaim.org/resources/contrastchecker/).

See the [accessibility guidelines](/accessibility/) and the [A11Y checklist](/a11y-checklist/) for more details.

## Integration

Install `@kesko/components` together with `@kesko/css`, which provides the design tokens and base styles it depends on, and `@kesko/themes` for your brand:

```sh
npm install @kesko/components @kesko/css @kesko/themes
```

Then load the base stylesheet and one brand theme once, in your app's entry point or root layout. Leave out `@kesko/css/components`: it mirrors the component styles for plain HTML, and `@kesko/components` already ships them.

```tsx
import "@kesko/css";
import "@kesko/themes/dist/k-rauta.css";
```

Finally, import the component into your project:

```tsx
import { Banner } from "@kesko/components";
```

Projects without React get the same markup and styling from `@kesko/css` by importing the base stylesheet, the `components` add-on and a brand theme, in that order:

```css
@import "@kesko/css";
@import "@kesko/css/components";
@import "@kesko/themes/dist/k-rauta.css";
```

The HTML examples above show the exact markup to copy.

## Resources

- [Usage guidelines](/components/usage/) — Learn how to use the component library with React, Next.js, or basic HTML.
- [Localization](/localization/) — How to translate the components for multiple languages.
- [CSS Framework](/css/) — Utilities and tokens for everything the components don’t cover.
- [Themes](/themes/) — How to customize the component library theme.
- [Accessibility checklist](/a11y-checklist/) — Interactive, browser-based Kesko accessibility checklist.

