import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; import { BannerBase } from './banner-base'; ### This is a base component. It should not be used in your feature code directly but as a "base" for other UI components # BannerBase `BannerBase` serves as a base for all banner variants. It contains standard props such as information and related actions. ## Props The `BannerBase` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props ### Title Use the `title` prop to pass a string that is sentence case no period. Use the `titleProps` prop to pass additional props to the `Text` component. ```jsx import { BannerBase } from '../../component-library'; Pass only a string through the title prop ; ``` ### Description The `description` is the content area of the `BannerBase` that must be a string. Description shouldn't repeat title and only 1-3 lines. If content requires more than a string, see `children` prop below. ```jsx import { BannerBase } from '../../component-library'; ; ``` ### Children The `children` prop is an alternative to `description` for `BannerBase` when more than a string is needed. Children content shouldn't repeat title and only 1-3 lines. ```jsx import { Size } from '../../../helpers/constants/design-system'; import { BannerBase } from '../../component-library'; {`Description shouldn't repeat title. 1-3 lines. Can contain a `} hyperlink. ; ``` ### Action Button Label, onClick, & Props Use the `actionButtonLabel` prop to pass text, `actionButtonOnClick` prop to pass an onClick handler, and `actionButtonProps` prop to pass an object of [ButtonLink props](/docs/components-componentlibrary-buttonlink--default-story) for the action ```jsx import { BannerBase, ICON_NAMES } from '../../component-library'; console.log('ButtonLink actionButtonOnClick demo')} > Use actionButtonLabel for action text, actionButtonOnClick for the onClick handler, and actionButtonProps to pass any ButtonLink prop types such as iconName ; ``` ### On Close Use the `onClose` prop to pass a function to the close button. The close button will appear when this prop is used. Additional props can be passed to the close button with `closeButtonProps` ```jsx import { BannerBase } from '../../component-library'; console.log('close button clicked')} > Click the close button icon to hide this notifcation ; ``` ### Start Accessory Use the `startAccessory` prop to add components such as icons or fox image to the start (default: left) of the `BannerBase` content ```jsx import { Size } from '../../../helpers/constants/design-system'; import { BannerBase, Icon, ICON_NAMES } from '../../component-library'; } > The info icon on the left is passed through the startAccessory prop ; ```