> To build a Wix site agentically, or add Wix features like bookings or a store to a site you already have, follow https://www.wix.com/headless/skill.md
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: TopBanner Component

## Article: TopBanner Component

## Article Link: https://dev.wix.com/docs/wix-design-system/components/feedback/top-banner-component.md

## Article Content:

# TopBanner

_Components/Feedback_

Interactive docs page: <https://wix-pages.com/design-system-documentation/#/component/topbanner>

## Overview

```jsx
() => {
  const [showBanner] = React.useState(true);

  return (
    <Box gap="20px" direction="vertical">
      {showBanner && (
        <TopBanner
          position="sticky"
          action={
            <TopBanner.ActionButton disabled>Upgrade</TopBanner.ActionButton>
          }
          onDismiss={() => {}}
        >
          Upgrade your site to start accepting payments.
        </TopBanner>
      )}
    </Box>
  );
};
```

Banners let's user know about ongoing promotions or marketing deals on their site.

### Do

- Use it to promote premium related offers or market features under premium plans.
- Use it with short and clear content.
- Provide a clear action that user can take with "action" property.
- Allow users to dismiss it.

### Don't

- Don't use it as a notification, to inform user about system status changes. Use `<StatusToast/>` instead.
- Don't use it with too much text. The component can support multiple lines, but it will cover content under it and take too much attention.

### Feature examples

#### Close button

Control if Top Banner can be closed by a users with `dismissible` prop.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <TopBanner
    dismissible={true}
    action={<TopBanner.ActionButton>Action</TopBanner.ActionButton>}
  >
    Banner is dismissable (default)
  </TopBanner>
  <TopBanner
    dismissible={false}
    action={<TopBanner.ActionButton>Action</TopBanner.ActionButton>}
  >
    Banner is not dismissable
  </TopBanner>
</StorybookComponents.Stack>;
```

#### Action

Add button to a top banner with `action` prop. It's recommended to always provide a corresponding action if possible.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <TopBanner
    dismissible={true}
    action={<TopBanner.ActionButton>Action</TopBanner.ActionButton>}
  >
    Banner has an action (default)
  </TopBanner>
  <TopBanner dismissible={true}>Banner has no action</TopBanner>
</StorybookComponents.Stack>;
```

#### Action type

Control type of action Top banner has through `action` property:

- Use `<TopBanner.ActionButton/>` to provide a main CTA (default).
- Use `<TopBanner.ActionTextButton/>` to provide a secondary action, like "Learn more".
- In specific cases, you can provide a different button styling as `action` is a node. This can also be used when more than one actions are needed.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <TopBanner
    dismissible={true}
    action={<TopBanner.ActionButton>Button</TopBanner.ActionButton>}
  >
    Banner has a button (default)
  </TopBanner>
  <TopBanner
    action={<TopBanner.ActionLink>Text button</TopBanner.ActionLink>}
    dismissible={true}
  >
    Banner has a text button
  </TopBanner>
  <TopBanner
    action={
      <Button skin="premium-light" size="small">
        Node{' '}
      </Button>
    }
    dismissible={true}
  >
    Banner action is a node
  </TopBanner>
</StorybookComponents.Stack>;
```

#### Position

Control whether the Top Banner sticks to the top of its container using the `position` prop:

- Use `static` (default) to allow the banner to scroll out of view beneath the top fold.
- Use `sticky` to keep the banner visible as the user scrolls, with content moving beneath it.

```jsx
() => {
  const [open, setOpen] = React.useState(true);

  return (
    <div style={{ height: '800px', overflow: 'scroll', position: 'relative' }}>
      <Collapse open={open} position="static">
        <TopBanner
          onDismiss={() => setOpen(false)}
          action={<TopBanner.ActionLink>Action</TopBanner.ActionLink>}
        >
          Top banner is static by default
        </TopBanner>
      </Collapse>
      <Page height="600px">
        <Page.Header
          title="Page Title"
          breadcrumbs={
            <Breadcrumbs
              items={[
                { id: 0, value: 'Page Name' },
                { id: 1, value: 'Page title' },
              ]}
            />
          }
          subtitle="I’m a relatively long subtitle to fill this space in."
          actionsBar={
            <div style={{ display: 'flex', gap: 6 }}>
              <Button skin="light">Button</Button>
              <Button skin="standard">Button</Button>
            </div>
          }
        />
        <Page.Content>
          <Card showShadow>
            <Card.Content>
              <Box height="180px" />
            </Card.Content>
          </Card>
        </Page.Content>
      </Page>
    </div>
  );
};
```

#### Height

Minimum component height is 48px. Component will grow together with the content provided. Heigh is not limited, so be cautious about providing very long texts as it will overlay content behind it.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <TopBanner
    dismissible={true}
    action={<TopBanner.ActionButton>Action</TopBanner.ActionButton>}
  >
    I am a short one line of text that does not wrap
  </TopBanner>
  <TopBanner
    dismissible={true}
    action={<TopBanner.ActionButton>Action</TopBanner.ActionButton>}
  >
    I am a longer content example that automatically wraps to a second line,
    while the top banner grows with it. The height is not limited, accommodating
    all languages and various messages. However, it may cover content on the
    page, so be cautious when writing texts.
  </TopBanner>
</StorybookComponents.Stack>;
```

### Common use case examples

#### In modals

Top banner component can be used inside of a modal or other container.

```jsx
() => {
  const [shown, setShown] = React.useState(false);

  return (
    <Card>
      <Card.Header
        title="Pricing plans"
        subtitle="Let clients book this service with a plan."
        suffix={
          <Button
            size="small"
            priority="secondary"
            prefixIcon={<Icons.AddSmall />}
            onClick={() => setShown(true)}
          >
            Create New Plan
          </Button>
        }
      />
      <Modal
        isOpen={shown}
        onRequestClose={() => setShown(false)}
        shouldCloseOnOverlayClick
        screen="desktop"
      >
        <CustomModalLayout
          primaryButtonText="Create Plan"
          secondaryButtonText="Cancel"
          onCloseButtonClick={() => setShown(false)}
          onHelpButtonClick={() => {}}
          secondaryButtonOnClick={() => setShown(false)}
          primaryButtonOnClick={() => setShown(false)}
          removeContentPadding
          title="Create new pricing plan"
          content={
            <Box direction="vertical">
              <TopBanner
                dismissible={true}
                action={
                  <TopBanner.ActionButton>Upgrade</TopBanner.ActionButton>
                }
              >
                Upgrade your site to start accepting payments.
              </TopBanner>
              <Page>
                <Page.Content>
                  <Box marginTop={5} display="block">
                    <Layout>
                      <Cell span={12}>
                        <Card>
                          <Card.Header
                            title="Plan info"
                            subtitle="Give your plan a name and tell customers what it includes"
                          />
                          <Card.Divider />
                          <Card.Content>
                            <Layout>
                              <Cell span={6}>
                                <FormField
                                  label="Name this plan"
                                  required
                                  charCount={20}
                                >
                                  <Input placeholder="e.g., Silver Membership" />
                                </FormField>
                              </Cell>
                              <Cell span={6}>
                                <FormField label="Add a tagline" charCount={60}>
                                  <Input placeholder="e.g., Perfect for beginners" />
                                </FormField>
                              </Cell>
                              <Cell span={12}>
                                <AddItem size="tiny">
                                  Add what this plan includes
                                </AddItem>
                              </Cell>
                            </Layout>
                          </Card.Content>
                        </Card>
                      </Cell>
                      <Cell span={12}>
                        <Card>
                          <Card.Header
                            title="Connect and manage benefits"
                            subtitle="Set up how your benefits work in this plan."
                          />
                          <Card.Divider />
                          <Box
                            display="block"
                            borderRadius={8}
                            paddingBottom="8px"
                          >
                            <SelectableAccordion
                              type="checkbox"
                              items={[
                                {
                                  title: 'Bookings Services',
                                  subtitle:
                                    'Offer services as a membership or package with this plan.',
                                  content: (
                                    <StorybookComponents.Placeholder>
                                      Booking Services content
                                    </StorybookComponents.Placeholder>
                                  ),
                                },
                                {
                                  title: 'Video Channels',
                                  subtitle:
                                    'Offer access to your Video Channel with this plan.',
                                  content: (
                                    <StorybookComponents.Placeholder>
                                      Video Channels content
                                    </StorybookComponents.Placeholder>
                                  ),
                                },
                                {
                                  title: 'Blog Subscriptions',
                                  subtitle: 'Give exclusive access to posts.',
                                  content: (
                                    <StorybookComponents.Placeholder>
                                      Blog Subscriptions content
                                    </StorybookComponents.Placeholder>
                                  ),
                                },
                                {
                                  title: 'Forum Subscriptions',
                                  subtitle:
                                    'Give exclusive access to forum categories.',
                                  content: (
                                    <StorybookComponents.Placeholder>
                                      Forum Subscriptions content
                                    </StorybookComponents.Placeholder>
                                  ),
                                },
                                {
                                  title: 'Events Memberships',
                                  subtitle:
                                    'Add ticket discount and ticket limit for your events.',
                                  content: (
                                    <StorybookComponents.Placeholder>
                                      Events Memberships content
                                    </StorybookComponents.Placeholder>
                                  ),
                                },
                                {
                                  title: 'Online Programs',
                                  subtitle:
                                    'Allow participation in different programs with this plan.',
                                  content: (
                                    <StorybookComponents.Placeholder>
                                      Online Programs content
                                    </StorybookComponents.Placeholder>
                                  ),
                                },
                                {
                                  title: 'Groups',
                                  subtitle:
                                    'Give clients access to exclusive groups.',
                                  content: (
                                    <StorybookComponents.Placeholder>
                                      Groups content
                                    </StorybookComponents.Placeholder>
                                  ),
                                },
                              ]}
                            />
                          </Box>
                        </Card>
                      </Cell>
                    </Layout>
                  </Box>
                </Page.Content>
              </Page>
            </Box>
          }
        />
      </Modal>
    </Card>
  );
};
```

#### In pages

Add top banner at the top of `<Page/>` to promotion premium.

```jsx
() => {
  return (
    <div style={{ height: '800px', overflow: 'scroll', position: 'relative' }}>
      <TopBanner
        position="sticky"
        action={
          <TopBanner.ActionButton as="a" href="lol">
            Upgrade
          </TopBanner.ActionButton>
        }
      >
        Upgrade your site to start accepting payments.
      </TopBanner>
      <Page>
        <Page.Header
          title="Pricing Plans"
          subtitle="Set up subscriptions, memberships or package plans to sell on your site."
          actionsBar={
            <div style={{ display: 'flex', gap: 6 }}>
              <Button skin="standard">Button</Button>
            </div>
          }
        />
        <Page.Content>
          <EmptyState
            image={<Image width="100px" src="no_categories.png" transparent />}
            title="Add your first pricing plan"
            subtitle="Collect payments from your users. You can connect up to 5 plans to your site"
            theme="page"
          >
            <TextButton prefixIcon={<Icons.Add />}>Add Plan</TextButton>
          </EmptyState>
        </Page.Content>
      </Page>
    </div>
  );
};
```

## Code

```jsx
import { TopBanner } from '@wix/design-system';
```

### Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `action` | `ReactNode` | — | An action component to display in the top banner. The component can be one of these types: Can be either: - `<TopBanner.ActionButton/>` - `<TopBanner.ActionLink/>` - custom On mobile (`<WixDesignSystemProvider mobile/>`) the action renders below the text and spans the banner width. |
| `children` | `ReactNode` | — | The main content of the top banner. |
| `dataHook` | `string` | — | Applies a data-hook HTML attribute that can be used in tests. |
| `dismissible` | `boolean` | `true` | Determines whether the top banner should render a dismiss button. |
| `dismissLabel` | `string` | — | Aria label for the dismiss button. |
| `onDismiss` | `(event: MouseEvent<Element, MouseEvent>) => void` | — | Callback function called whenever the user clicks the dismiss button. |
| `position` | `"static" \| "sticky"` | `static` | Determines if the top banner stays fixed at the top of its container. |
| `zIndex` | `number` | `1` | Controls the z-index of the component. |

## Testkit

Import the driver matching your test environment:

```jsx
// UniDriver
import { TopBannerUniDriver } from '@wix/design-system/dist/testkit/unidriver';

// Vanilla
import { TopBannerTestkit } from '@wix/design-system/dist/testkit';

// Puppeteer
import { TopBannerTestkit } from '@wix/design-system/dist/testkit/puppeteer';

// Testing Library
import { TopBannerTestkit } from '@wix/design-system/dist/testkit/testing-library';
```

### Driver methods

| Method | Description |
| --- | --- |
| `getContent` | Gets the content of top banner. |
| `hasDismissButton` | Checks if the dismiss button exists. |
| `clickDismissButton` | Clicks the dismiss button |
| `exists` | Checks whether the component found with the given data hook. |
| `element` | Gets the component root element. |
| `click` | Clicks on the component root element. |
| `base` | Returns UniDriver for the base element. |

## Changelog

- **1.340.0** (2026-10-21) — maintenance release, no component-specific changes
- **1.339.0** (2026-10-19) — maintenance release, no component-specific changes
- **1.338.0** (2026-10-15) — maintenance release, no component-specific changes
- **1.335.0** (2026-10-12) — feat: on mobile (`WixDesignSystemProvider` with `mobile`) the banner stacks vertically. The text and the dismiss button share the top row, the text is start-aligned and uses the full width left by the dismiss button, and the action renders below as a full-width small button. The dismiss button keeps its 24px icon and gets a 44px touch area. The banner grows with its content and mirrors fully in RTL. Desktop is unchanged. ([#17332](invalid-url)) — has visual changes
- **1.330.0** (2026-09-28) — maintenance release, no component-specific changes
- **1.329.0** (2026-09-24) — maintenance release, no component-specific changes
- **1.328.0** (2026-09-22) — maintenance release, no component-specific changes
- **1.327.0** (2026-09-21) — maintenance release, no component-specific changes
- **1.325.0** (2026-09-17) — maintenance release, no component-specific changes
- **1.310.0** (2026-08-10) — maintenance release, no component-specific changes
- **1.305.1** (2026-07-30) — fix: restore readable contrast for the text and the dismiss icon — their color now follows the banner fill via `--wds-top-banner-content-color`, so themes with the purple fill get light content again instead of the dark content intended for Harmony (odeditor)'s light fill. ([#16648](invalid-url)) — has visual changes
- **1.299.0** (2026-07-17) — breaking: update visual styling ([#16579](invalid-url)) — has visual changes
- **1.292.0** (2026-06-22) — maintenance release, no component-specific changes
- **1.260.0** (2026-03-17) — maintenance release, no component-specific changes
- **1.254.0** (2026-02-03) — maintenance release, no component-specific changes
- **1.250.0** (2026-01-27) — maintenance release, no component-specific changes
- **1.169.0** (2025-03-10) — maintenance release, no component-specific changes
- **1.144.0** (2024-12-03) — maintenance release, no component-specific changes
- **1.143.0** (2024-11-25) — feat: premium top banner ([#14296](invalid-url))