Alert

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 messages
  • success - used to show success messages like successful order placement
  • warning - used to show warning messages
  • error - used to show error messages like payment failed

Alert also provides it's own Button component which is basically a wrapper of Button component.

Usage

The Alert component can be imported using

import { Alert } from '@tail-kit/tail-kit'

Info Alert

Some additional information

Success Alert

Order placed
Your order has been placed successfully. You can expect to recieve your order by 26th August

Warning Alert

Attention needed
Lorem ipsum dolor sit amet consectetur adipsicing elit. Aliquid pariatur, ipsum similique veniam.

Error Alert

There were 2 errors with your submission
  • Your password must be at least 8 characters
  • Your password must included at least one pro wrestling finishing move

Title Only Alert

The quick, brown fox jumps over a lazy dog.

Alert With Custom icon

This webpage is now bookmarked

Alert With action

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.

You can change the title by changing the Title knob

Also you can change the message by changing the Message knob

  • 623 KC will be refunded by your payment card
  • 623 KC will be refunded by your payment card

Error Alert With action

There were 2 errors with your submission
  • Your password must be at least 8 characters
  • Your password must included at least one pro wrestling finishing move

Alert Props

NameDescriptionDefault 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
--

Alert Button Props

Apart from the following props, the Alert Button component accepts all the props of the Button component.

NameDescriptionDefault Value
className
additional class applied to button
string | undefined
--
buttonType
"primary" | "default" | undefined
default