runway

Runway

Alert

An alert component for displaying important messages.


This is an info message.
This is a success message.
This is a warning message.
This is a danger message.

The Alert component is a simple yet effective way to display important messages to users. It supports various severity levels, including info, success, warning, and error, allowing you to convey the urgency of the message effectively.




Usage

javascript

1import Alert from '@/components/atoms/Alert';
2
3<Alert severity="info">This is an info message.</Alert>



Props

PropTypeDefaultDescription
childrenReactNode-Content to be displayed inside the alert component
severity"info" | "success" | "warning" | "error""info"Severity level of the alert component (info, success, warning, error)
variant"soft" | "solid""soft"Variant style of the alert component
liftbooleanfalseWhether to lift the alert component on hover
scalebooleanfalseIf true, gently scales up on hover.
liftbooleanfalseIf true, lifts on hover.
activebooleantrueIf true, the button has an active press-down scale effect.
borderbooleanfalseWhether to show a border around the alert component
onClickfunction-Function to call when the alert is clicked
classNamestring""Additional Tailwind classes (overrides defaults)
...propsobject-Any other valid HTML <div> attributes (e.g. role, aria-*, etc.).



Examples

1. Basic Alert

Just provide a severity prop.

This is an info message.
This is a success message.
This is a warning message.
This is a danger message.

Make Alert clickable by adding an onClick prop.

2. Styled Alert

You can customize the alert with variants, borders and additional Tailwind classes.

This is a soft alert with a border.
This is a soft alert with custom background color.

3. Hover Alert

You can add a hover effect to the alert by setting the lift or scale prop.

This is an info message.
This is a success message.
This is a warning message.