Banners prominently communicate contextual information.
The component can be imported via:
A banner's variant is tied to its semantic meaning, and determines
the color and default icon used in a banner. The available variants are:
default
information
success
caution
error
feature
A banner contains 3 different style types:
inline
alert
announcement
Use the title to efficiently communicate the core of the message. Starting a title with a short phrase ('Heads up!', 'Oh no!', 'Pro tip:', etc.) can help communicate the tone.
The banner's body text can be provided with the description prop in React or the @description argument in Ember:
Rich description content, like links, may be passed into the description prop or Ember description named block:
Regular React children and Ember default yielded content render directly in the banner content area. Use BannerTitle/BannerDescription or PlumaBannerTitle/PlumaBannerDescription when composing custom content that should match Banner title and description styles:
The banner will default to an icon that is appropriate for the chosen variant.
The icon can be changed with the icon prop:
Be careful when choosing an icon to avoid miscommunication. For example,
don't show a checkmark in a error banner.
Add a primary action to a banner when an action is possible outside of closing/dismissing the banner. The label for the action is customizable.
Example: Saving some data failed, so the user can try again from the alert.
The action prop accepts an object that represents either a link or a button.
If the href key is present, the banner will render a link (styled like a button).
Otherwise, a button will be rendered.
The shape of the object is:
or
The variant property allows you to customize the button's visual style. By default, banner action buttons use the "subtle" variant.
The isLoading property can be used to manually set the action button to a loading state, which shows a spinner and disables interactions. The autoLoading property (enabled by default) will automatically set the button to a loading state when the onClick handler returns a Promise, until that Promise resolves or rejects.
Sometimes, you may also want to display a "dismiss" button along with the action.
This can be accomplished by enabling shouldShowDismissButton and passing in an
onClose callback (which will be called when the button is clicked):
The text of the button can be changed with the dismissButtonText prop.
If this prop is present, shouldShowDismissButton is not required:
As an alternative to the "dismiss" button, an "X" close button can be displayed.
This can be enabled by passing in an onClose callback, but without enabling
shouldShowDismissButton or customizing dismissButtonText:
By default, banners have a colored background. You can use the isOutlined prop to switch to an outlined style with a white background and a colored border:
PlumaBanner extends BoxAction button to render in the banner.
The description of the banner, if any.
Default:'Dismiss'
The text to show in the dismiss button
The name of an icon (from Pluma Icons) to render in the banner.
Whether the close button should be disabled.
Whether the dismiss button should be disabled.
Default:false
Whether the banner should have a white background with a colored border.
Function to call when the "X" close button is clicked.
Providing this prop will render the close button (unless shouldShowDismissButton is also enabled).
Whether a "dismiss" action button should be rendered inside the banner.
Calls onClose when clicked, if provided.
The title of the banner, if any.
Default:inline
The type of banner to render.
Default:default
The semantic variant (color) of banner to render.
Whether the banner should be rendered with a responsive container.
This automatically stacks the content and actions when the banner is too narrow. By default, it is true when the banner type is 'inline' and we are not showing the close button.