# Banner, promo code

- **[Sections](/blocks/)**
- **[Banner](/blocks/banner/)**
- **Banner, promo code**

A slim bar above the navbar for a campaign: a short badge, one line of text, the discount code in a dashed chip, and a link. Empty badge or code drops that part.

## Import

- **CLI**

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

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

Also called

- banner/promo

- **Category**: Announcement bars and the cookie notice. New project? Set it up once: /get-started/installation.

## Notes

- **When to use it**: A slim bar above the navbar for a time-limited campaign, with a badge, a line of text and a discount code in a dashed chip. For general news without a code, `banner-announcement` is simpler and can be dismissed.
- **Writing for it**: - The badge holds 24 characters and names the campaign, like Autumn offer. It is a label, not a sentence.
- The text holds 120 characters; state the deal and its limits, such as days or conditions, because the code chip carries no explanation.
- The code holds 24 characters. Write it exactly as the shopper must type it, including capitals and special letters.
- **Watch out for**: Badge and code each vanish from the bar when left empty, and the link goes the same way with an empty label. A bar with all three empty is reduced to the text line alone.

## Pairs well with

- **[Navbar, utility bar](/blocks/navigation/utility)**
- **[Hero, split](/blocks/hero/split)**
- **[Pricing, packages](/blocks/pricing/packages)**

## 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 BannerPromo from '@/components/klarhimmel/blocks/banner-promo';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <BannerPromo props={{
          "badge": "Name the offer",
          "text": "Say what the offer is and when it applies.",
          "code": "CODE00",
          "link": {
            "label": "Read more",
            "href": "/rooms"
          }
        }} />
      </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.

- **badge**: Text, up to 24 characters.
- **text**: Text, up to 120 characters.
- **code**: Text, up to 24 characters.
- **link**: See the type.

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

[Next](/blocks/banner/floating-actions)
