Alerts#
The <Alert> component displays a brief & important message in a way that attracts a user's attention without interrupting a user's task.
If you are needing to display more descriptive, but important message to a user, consider using the <Callout> component.
Import#
import { Alert } from 'bumbag'
Usage#
Titles#
You can set a title with the title prop.
Types#
An alert can take a type of "info", "success", "warning" or "danger".
Accents#
Alerts can have bordered accents.
Variants#
The <Alert> component comes with three default variants:
- An alert with a border,
- An alert with a tint,
- A filled alert.
You can even make your own Alert variant.
Bordered#
Tint#
Fill#
Accessibility#
The <Alert> component follows the WAI ARIA Alert Pattern.
Patterns#
- The component has a role of
"alert". - If an alert has a title, then the
aria-labelledbyattribute is set on the component. - If an alert has a description, then the
aria-describedbyattribute is set on the component.
References#
Props#
Alert Props#
accent true | "top" | "bottom"
Placement of the accent (the side border).
accentSize string
Size of the accent (in px).
countdown number
Countdown timer of the alert (in ms).
hasIcon boolean
Should the alert have an icon depending on its type?
isInline boolean
Is the alert inline, and has the title beside its content?
onClickClose (event: MouseEvent<any, MouseEvent>) => void
Function to invoke when the alert close button is pressed.
showCloseButton boolean
Whether or not to show the close button.
title string
The title of the alert.
type "success" | "danger" | "warning" | "info"
The type of the alert.
closeButtonProps
{
unstable_system?: any;
top?: string | number | {
[key: string]: string
}; right?: string | number | {
[key: string]: string
}; bottom?: string | number | {
[key: string]: string
}; left?: string | number | {
[key: string]: string
}; ... 807 more ...;
ignoreGrayOverride?: boolean;
}The props to spread onto the close button.
closeButtonIconProps
{
unstable_system?: any;
top?: string | number | {
[key: string]: string
}; right?: string | number | {
[key: string]: string
}; bottom?: string | number | {
[key: string]: string
}; left?: string | number | {
[key: string]: string
}; ... 787 more ...;
label?: string;
}The props to spread onto the close button icon.
iconProps
{
unstable_system?: any;
top?: string | number | {
[key: string]: string
}; right?: string | number | {
[key: string]: string
}; bottom?: string | number | {
[key: string]: string
}; left?: string | number | {
[key: string]: string
}; ... 787 more ...;
label?: string;
}The props to spread onto the alert icon.
Inherits Flex props
Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Alert.Icon Props#
iconProps
{
unstable_system?: any;
top?: string | number | {
[key: string]: string
}; right?: string | number | {
[key: string]: string
}; bottom?: string | number | {
[key: string]: string
}; left?: string | number | {
[key: string]: string
}; ... 787 more ...;
label?: string;
}Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Alert.Content Props#
Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Alert.Title Props#
Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Alert.Description Props#
Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Theming#
Alert.styles.baseAlert.Content.styles.baseAlert.Title.styles.baseAlert.Description.styles.baseAlert.IconWrapper.styles.baseAlert.CloseButton.styles.base