Alert

An Alert component is a UI element used to display important messages or notifications to users. It can convey different types of information such as success, warning, error, or informational messages, typically styled with distinct colors and icons to highlight the message's significance. Alerts are often used to grab the user's attention and provide immediate feedback on actions or events.
# Demo
# Attributes
NameTypeDefaultDetails
classNamestring' 'You can customise by passing tailwind classes.
titleClassNamestring' 'You can customise by passing tailwind classes.
closeClassNamestring' 'You can customise by passing tailwind classes.
messageClassNamestring' 'You can customise by passing tailwind classes.
typeAlertTypesAlertTypes.DEFAULTYou can pass type of the alert.
titlestringRenders based on the type you passed.You can pass alert title.
messagestringRequiredYou can pass alert message.
onClose() => voidRequiredYou can get callback when alert got closed.
# Usage
import { NAlert, AlertTypes } from 'nayan'; const Alert = () => { return ( <div> <NAlert type={AlertTypes.DEFAULT} message="New version available!" className="mb-3" onClose={() => console.log('Alert closed')} /> <NAlert type={AlertTypes.INFO} message="New version available!" className="mb-3" onClose={() => console.log('Alert closed')} /> <NAlert type={AlertTypes.SUCCESS} message="New version available!" className="mb-3" onClose={() => console.log('Alert closed')} /> <NAlert type={AlertTypes.WARNING} message="New version available!" className="mb-3" onClose={() => console.log('Alert closed')} /> <NAlert type={AlertTypes.ERROR} title="Error!" message="New version available!" className="mb-3" onClose={() => console.log('Alert closed')} /> </div> ); }; export default Alert;