Banner
Banner is a component to render alert notifications. They are composed of banner items describing errors as per the usecase.
Examples
Banners with different intents
This is Error Banner Component
Banners with different list types
- Error 1
- Error 2
- Error 3
- Error 1
- Error 2
- Error 3
This is Error Banner Component
The list type of the banner items (i.e numeric or bullets) can be handled by providing $as
prop. Whenever $as
is set to ul
or ol
, the role
of BannerItemContainer
will automatically be set to list
. To provide custom role
to BannerItemContainer
, pass role
prop to Banner
component.
Fixed Height Banner
- Error 1
- Error 2
- Error 3
- Error 4
- Error 5
- Error 6
- Error 7
- Error 8
- Error 9
- Error 10
To fix the height of error list container, user needs to provide overrides to BannerItemContainer
or Root
.
Title property of Banner accepts ReactNode. Hence, a custom title component can also be passed to the title prop of banner.
Don't unmount banner on the basis of visible
prop. Instead let Banner handle the state, or else animation
won't work
API
Banner props
Name | Type | Default | Description |
---|---|---|---|
$as | 'ol' | 'ul' | 'div' | div | Defines the numeric/bullet/none style for bannerItem list |
children | react node | Banner items | |
className | string | Classes to apply on Banner Root | |
closeable | boolean | false | should banner be a closeable banner (user would need to control the visiblity using visible prop) |
collapsible | boolean | true | Adds show/hide button to the banner. |
intent | 'error' | 'warning' | 'success' | 'info' | error | Defines the intent of the banner. |
maxItemContainerHeight | string | Sets max height of the items container list. | |
overrides | custom | Lets you customize all aspects of the component. | |
title | react node | Defines the title of the banner. | |
visible | boolean | true | To control visibility for closeable icon with the state update function given as onClose |
BannerItem props
Name | Type | Default | Description |
---|---|---|---|
children | react node | Banner items content | |
className | string | Classes to apply on Banner Root | |
overrides | custom | Lets you customize all aspects of the component. |
You can check the implementation of the component for more details.
Banner exports
You can import this module like so:
import {Banner} from 'spaceweb/banner'
It exports the following components or utility functions:
- Banner
- BannerItem
- StyledBanner
- StyledBannerItem
- StyledTitle