Skip to main content

Banner

Quick start

Here's a quick start guide to get started with the Banner component

Importing Component

import { Banner } from "@hover-design/react";

Code Snippets and Examples

<div className="App">
<Banner title="Info Banner" />
</div>
<div className="App">
<Banner title="Bruce Banner" type="success" />
</div>
<div className="App">
<Banner title="Warning" type="warning" />
</div>
<div className="App">
<Banner title="Danger" type="danger" />
</div>
<div className="App">
<Banner title="Banner with icons" showIcon />
</div>

Note: Each Banner type has a default icon associated with it.

<div className="App">
<Banner title="Banner with Description" type="warning" showIcon>
This is a Banner Description
</Banner>
</div>
<div className="App">
<Banner
title="Banner has CTA"
showCtaButton
ctaAction={() => {
window.alert("Banner Clicked!");
}}
/>
</div>
<div className="App">
<Banner title="Center Aligned Banner" alignment="center" />
</div>
<div className="App">
<Banner title="Filled Banner" variant="filled">
This is a Filled Banner
</Banner>
</div>
<div className="App">
<Banner title="Outline Banner" variant="outline">
This is an Outline Banner
</Banner>
</div>
<Banner title="Custom Colors" color="hotpink" backgroundColor="lavenderblush">
This is a Custom Banner
</Banner>

Props Reference

AttributesValuesDefault ValueOptional ?
variantlight | filled | outlinelightYes
typeinfo | success | warning| dangerinfoYes
titleReactNodeYes
iconReactNodeYes
colorstringYes
borderRadiusstring4pxYes
backgroundColorstringYes
alignmentleft | center | rightleftYes
showCtaButtonbooleanfalseYes
ctaIconReactNodeYes
ctaAction()=>voidYes

Custom Styles

Note: It is advised to use these classNames scoped inside of the className given as prop to the main component.

ClassNameElement
hover-banner-alertAlert Component Used in this component
hover-banner-cta-iconCTA Icon container
hover-alert-titleTitle container
hover-alert-descriptionDescription Container
hover-alert-iconIcon Container