[Components](https://oods-foundry.com/components) / primitive

# Banner

Presents a prominent message with optional actions and dismissal.

Generated from @oods/foundry 0.10.1

- Categories

  primitive, visual

- Contexts

  detail, form, list

- Readiness

  `proven-in-generated-apps`

## Playground

This component's contract doesn't list typed props, so the playground shows its documented example.

Documented example `banner-dismissible` : activate dismiss button, dismiss event emitted once.

The render follows the page's theme switch: light, dark or high contrast. Both frameworks render the same example.

The real Banner, live

React

**Payment failed**

Update the card

Vue

**Payment failed**

Update the card

Events it emits: dismiss. Use either render above, and each event shows here with the framework that sent it.



## Code

The documented example. HTML is the markup the React component renders for it, which @oods/component-styles styles.

**React**

```
import { Banner, Button } from '@oods/components-react';
import '@oods/component-styles/css';

export function Example() {
  return (
    <Banner
      title="Payment failed"
      detail="Update the card"
      tone="critical"
      dismissLabel="Dismiss payment warning"
      actions={<Button content="Update card" />}
    />
  );
}
```

## Props, slots and events

Contract version 1.1.0. Types are from the React declarations in @oods/components-react.

Props

| Prop | Type | Required | Documented example |
| - | - | - | - |
| `title` | `ReactNode` | no | `Payment failed` |
| `detail` | `ReactNode` | no | `Update the card` |
| `content` | `ReactNode` | no | |
| `status` | `string \| undefined` | no | |
| `domain` | `string \| undefined` | no | |
| `tone` | `ComponentTone \| undefined` | no | `critical` |
| `emphasis` | `ComponentEmphasis \| undefined` | no | |
| `dismissLabel` | `string \| undefined` | no | `Dismiss payment warning` |

### Slots

default, actions

### Events

dismiss

## States

info, success, warning, critical

## Accessibility

- Role

  `button`

- How it gets its name

  `aria-label` on `button[aria-label="Dismiss payment warning"]`

### Keyboard

Keyboard

| Key | What it does |
| - | - |
| `Tab` | Move focus to the named native control |
| `Enter` | Activate the control |

### Obligations in the contract

- Critical tone uses alert
- Other tones use status
- Dismiss control has an accessible label

Dismissal is a real button and actions remain authored content.

## Tokens

The token roles this component reads.

- `banner.background`
- `banner.border`
- `banner.text`
- `banner.icon`

## Readiness

The evidence recorded for this component, with its label.

`proven-in-generated-apps`: catalog_list gives this label when generated React and Vue apps in the runtime sweep that ships with this version both use the component. That sweep was measured on the published 0.4.1, not on this version.

Readiness evidence

| Evidence | React | Vue |
| - | - | - |
| state | implemented-evidence-complete | implemented-evidence-complete |
| versioned contract | passed | passed |
| target implementation | passed | passed |
| package export | passed | passed |
| public declaration | passed | passed |
| dependency closure | passed | passed |
| framework scenario | passed | passed |
| accessibility | verified | verified |
| interaction | verified | verified |
| visual themes | verified | verified |

## Use your own

You can replace this component with your own React or Vue component. Map it, and generated code imports yours at the exact version you name. A contract report, run in a real browser, lists what your component met, what it didn't, and what wasn't checked.

The `component_map` call, with the parts in angle brackets yours to fill:

```
{
  "action": "create",
  "apply": true,
  "externalSystem": "<your design system>",
  "externalComponent": "<YourBanner>",
  "oodsTraits": [
    "Statusable"
  ],
  "substitution": {
    "component": "Banner",
    "react": {
      "package": "<your-package>/react",
      "version": "<exact version>",
      "export": "<YourBanner>"
    },
    "vue": {
      "package": "<your-package>/vue",
      "version": "<exact version>",
      "export": "<YourBanner>"
    }
  }
}
```

## How this page was made

Generated at build from the published data, each source with the hash of what was read. [The page's manifest](https://oods-foundry.com/components/banner/manifest.json).

- **Contract**: `@oods/component-contracts@0.10.1 componentContracts.Banner` `sha256:c045708902f5…`
- **Documented example**: `@oods/component-contracts@0.10.1 sharedScenarios banner-dismissible` `sha256:479c744c32a6…`
- **Catalog entry (catalog_list)**: `generated/0.10.1/system/catalog.json Banner` `sha256:4bae8a290921…`
- **React readiness**: `@oods/components-react@0.10.1 readiness Banner` `sha256:335e954a5bb8…`
- **Vue readiness**: `@oods/components-vue@0.10.1 readiness Banner` `sha256:531ffb42af67…`
- **Prop types**: `generated/0.10.1/components/prop-types.json Banner` `sha256:8c1d7c25d8f0…`
