Alert component is used to show feedback and alert messages to users.
Alert component provides following four types of alerts:
info
- used to show information messagessuccess
- used to show success messages like successful order placementwarning
- used to show warning messageserror
- used to show error messages like payment failedAlert also provides it's own Button component which is basically a wrapper of Button component.
The Alert component can be imported using
import { Alert } from '@tail-kit/tail-kit'
You can also use Button component in the actions prop of Alert
component.
Alert.Button
internally uses the same baseColor as of the Alert
component using context API.
Also you can change the message by changing the Message knob
Name | Description | Default Value |
---|---|---|
type | Type of the alert to use predefined icons and styles "info" | "success" | "warning" | "error" | undefined | info |
title | Alert title ReactNode | -- |
content | Alert content ReactNode | -- |
icon | Alert icon boolean | Element | undefined | -- |
actions | Alert action buttons Element | undefined | -- |
closable | Making alert closable. It would render (X) button boolean | undefined | -- |
onClose | Function to be called on pressing the (X) button ((event: MouseEvent<HTMLButtonElement, MouseEvent>) => void) | undefined | -- |
className | Add className for custom styling string | undefined | -- |
style | Add style object for custom styling CSSProperties | undefined | -- |
Apart from the following props, the Alert Button component accepts all the props of the Button component.
Name | Description | Default Value |
---|---|---|
className | additional class applied to button string | undefined | -- |
buttonType | "primary" | "default" | undefined | default |