v2.2.3

Alert

Installation

Install yarn add @spark-web/alert
Source GitHub.com
Bundle unpkg.com

Alert displays a short and concise message to draw a users' attention without interrupting their current task.

Examples

Tones

The component offers several levels of tonal severity.

Closing

You can also set an onClose prop callback function which will render a close icon button on the alert. The callback function will be called upon the button being pressed.

Custom icons

In rare cases, you may need to provide a custom icon. To do so, we expose an icon prop. You can pass it any icon from the Icon package.

Props

PropTypeDescription

children

ReactNode: string | number | false | true | {} | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

The body content of the alert.

closeLabel?

string

Sets a label for the close button if the close icon button is present.

Default: "Dismiss alert"

data?

DataAttributeMap

Sets data attributes on the component.

heading?

string

Sets a heading for the alert.

icon?

ForwardRefExoticComponent<IconProps & RefAttributes<SVGSVGElement>> | IconWithWithoutRef

Optionally provide a custom icon to be used instead of the default icon.

id?

string

Sets a unique indentifier on the component.

onClose?

() => void

Sets a callback function when the alert close icon button is pressed. If the onClose function is not defined, the close icon button will not be rendered on the alert component.

tone?

"caution" | "critical" | "info" | "positive"

Sets the tone of the alert.

Default: "info"

© 2023 Brighte Capital Pty Ltd