Displays a callout for user attention.
Danger
Info
Success
Warning
Danger w/ custom icon
import { Alert } from "@ngrok/mantle/alert";
import { ShrimpIcon } from "@phosphor-icons/react/Shrimp";
<Alert.Root priority="danger">
<Alert.Icon />
<Alert.Content>
<Alert.Title>Danger</Alert.Title>
<Alert.Description>This is a danger Alert.</Alert.Description>
</Alert.Content>
</Alert.Root>
<Alert.Root priority="info">
<Alert.Icon />
<Alert.Content>
<Alert.Title>Info</Alert.Title>
<Alert.DismissIconButton />
<Alert.Description>This is an info Alert.</Alert.Description>
</Alert.Content>
</Alert.Root>
<Alert.Root priority="success">
<Alert.Icon />
<Alert.Content>
<Alert.Title>Success</Alert.Title>
<Alert.Description>This is a success Alert.</Alert.Description>
</Alert.Content>
</Alert.Root>
<Alert.Root priority="warning">
<Alert.Icon />
<Alert.Content>
<Alert.Title>Warning</Alert.Title>
<Alert.Description>This is a warning Alert.</Alert.Description>
</Alert.Content>
</Alert.Root>
<Alert.Root priority="danger">
<Alert.Icon svg={<ShrimpIcon />} />
<Alert.Content>
<Alert.Title>Danger w/ custom icon</Alert.Title>
<Alert.Description>This is a danger Alert.</Alert.Description>
</Alert.Content>
</Alert.Root>Examples
Composition
You can mix and match what you put inside the Alert component to create different types of Alert layouts.
Danger Alert with icon and AlertDismissIconButton
Danger Will Robinson
Danger Alert without icon
Danger Will Robinson
Danger Alert with icon and no description
Danger Will Robinson
Danger Alert without icon or description, but including AlertDismissIconButton.
Danger Will Robinson
import { Alert } from "@ngrok/mantle/alert";
// Danger Alert with icon and Dismiss Icon Button
<Alert.Root priority="danger">
<Alert.Icon />
<Alert.Content>
<Alert.Title>Danger Will Robinson</Alert.Title>
<Alert.DismissIconButton />
<Alert.Description>This is a danger alert.</Alert.Description>
</Alert.Content>
</Alert.Root>
// Danger Alert without icon
<Alert.Root priority="danger">
<Alert.Content>
<Alert.Title>Danger Will Robinson</Alert.Title>
<Alert.Description>This is a danger alert.</Alert.Description>
</Alert.Content>
</Alert.Root>
// Danger Alert with icon and no description
<Alert.Root priority="danger">
<Alert.Icon />
<Alert.Content>
<Alert.Title>Danger Will Robinson</Alert.Title>
</Alert.Content>
</Alert.Root>
// Danger Alert without icon or description, but including a Dismiss Icon Button
<Alert.Root priority="danger">
<Alert.Content>
<Alert.Title>Danger Will Robinson</Alert.Title>
<Alert.DismissIconButton />
</Alert.Content>
</Alert.Root>Banners
For banner-like alerts, use the appearance="banner" prop. This automatically removes the top, left, and right borders, leaving only the bottom border.
This is an info Alert as a page banner
Laboris commodo Lorem anim consequat ut dolore proident.
import { Alert } from "@ngrok/mantle/alert";
<Alert.Root priority="info" appearance="banner">
<Alert.Icon />
<Alert.Content>
<Alert.Title>This is an info Alert as a page banner</Alert.Title>
</Alert.Content>
</Alert.Root>API Reference
The Alert displays a callout for user attention and is composed of several sub-components.
Alert
Displays a callout for user attention. Root container for all Alert sub-components.
All props from div, plus:
AlertContent
The container for the content slot of an Alert. Place the AlertTitle and AlertDescription and AlertDismissIconButton as direct children.
All props from standard HTML div attributes
AlertDescription
The optional description of an Alert. Renders as a div by default, but can be changed to any other element using the asChild prop.
All props from standard HTML p attributes, plus:
AlertIcon
An optional icon that visually represents the priority of the Alert. The default rendered icon be overridden with a custom icon using the svg prop.
All props from standard HTML svg attributes, plus:
AlertTitle
The title of an Alert. Default renders as an h5 element; use asChild to render something else.
All props from standard HTML h5 attributes, plus:
Alert.DismissIconButton
A dismiss icon button that closes the alert when clicked.
All props from button, plus: