---
layout: ~/layouts/MdxDocLayout.astro
title: "Banner"
description: "Displays contextual inline messages for informational, alert, or error states."
sourceFile: "components/banner"
---

import ComponentExample from "~/components/docs/ComponentExample.astro";
import ComponentSection from "~/components/docs/ComponentSection.astro";
import CodeBlock from "~/components/docs/CodeBlock.astro";
import PropsTable from "~/components/docs/PropsTable.astro";
import {
  BannerVariantsDemo,
  BannerDefaultDemo,
  BannerAlertDemo,
  BannerErrorDemo,
  BannerWithIconDemo,
  BannerWithActionDemo,
  BannerWithActionsDemo,
  BannerCustomContentDemo,
} from "~/components/demos/BannerDemo";

{/* Hero Demo */}

<ComponentSection>
  <ComponentExample demo="BannerVariantsDemo">
    <BannerVariantsDemo client:visible />
  </ComponentExample>
</ComponentSection>

{/* Installation */}

<ComponentSection>

## Installation

### Barrel

  <CodeBlock code={`import { Banner } from "@cloudflare/kumo";`} lang="tsx" />

### Granular

  <CodeBlock
    code={`import { Banner } from "@cloudflare/kumo/components/banner";`}
    lang="tsx"
  />
</ComponentSection>

{/* Usage */}

<ComponentSection>

## Usage

```tsx
import { Banner } from "@cloudflare/kumo";
import { Info } from "@phosphor-icons/react";

export default function Example() {
  return (
    <Banner
      icon={<Info weight="fill" />}
      title="Update available"
      description="A new version is ready to install."
    />
  );
}
```

</ComponentSection>

{/* Examples */}

<ComponentSection>

## Examples

### Variants

#### Default

<ComponentExample demo="BannerDefaultDemo">
  <BannerDefaultDemo client:visible />
</ComponentExample>

#### Alert

<ComponentExample demo="BannerAlertDemo">
  <BannerAlertDemo client:visible />
</ComponentExample>

#### Error

<ComponentExample demo="BannerErrorDemo">
  <BannerErrorDemo client:visible />
</ComponentExample>

### With icon

<ComponentExample demo="BannerWithIconDemo">
  <BannerWithIconDemo client:visible />
</ComponentExample>

### With action

  <ComponentExample demo="BannerWithActionDemo">
    <BannerWithActionDemo client:visible />
  </ComponentExample>

### With multiple actions

  <ComponentExample demo="BannerWithActionsDemo">
    <BannerWithActionsDemo client:visible />
  </ComponentExample>

### Custom content

  <ComponentExample demo="BannerCustomContentDemo">
    <BannerCustomContentDemo client:visible />
  </ComponentExample>
</ComponentSection>

{/* API Reference */}

<ComponentSection>

## API Reference

  <PropsTable component="Banner" />
</ComponentSection>
