Skip to main content

Banner

A Banner is displayed when a user lands on a page to provide a message or greeting. The user can simply click on the banner to remove it.

Use cases:

  • displaying a greeting
  • displaying information, such as changes to a page

Example​

This example shows a simple banner. You can click to remove it. (Reload the page to see the banner again.)

A banner for displaying information... Click to dismiss!

Declaration

<Banner></Banner>

Usage

import { Banner } from '@genesislcap/rapid-design-system/react';

export function MyComponent() {
const bannerRef = useRef(null);
const handleClick = (e) => {
bannerRef.current?.dismiss();
}
return (
<Banner onClick={handleClick}>
<div slot="content">
A banner for displaying information... Click to dismiss!
</div>
</Banner>
);
}

API​

Attributes​

This component doesn't have any attributes.

Properties​

This component doesn't have any properties.

Methods​

MethodDescription
dismissDismisses the banner.

Slots​

NameDescription
DefaultThe default slot for the banner text.

Parts​

NameDescription
controlThe element representing the banner, which wraps the default slot.

Events fired​

This component doesn't fire any events.

Events listened to​

This component doesn't listen to any events.