suiss/ui · Component
Alert
A static callout that draws attention to an important message without interrupting the user.
Alert is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
An Alert is a rounded container with an optional leading icon, an AlertTitle, an optional AlertDescription and an optional AlertAction. Place the icon as a direct child; the layout switches to a two-column grid so the title and description align beside it.
Use an alert for inline, persistent messages such as updates, warnings or errors. To interrupt the user and require a decision, use Alert Dialog instead; for short-lived notifications, use Toast.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
- Install the dependencies and add the
cnhelper:
- Copy the source into
components/ui/alert.tsx:
- Update the import paths to match your project.
Usage
Put an icon from your icon library (or any svg) first inside Alert; it is sized to size-5 unless it already has a size class. When AlertDescription is present the icon spans both rows.
AlertAction is positioned in the top-end corner, and the alert reserves end padding for it automatically.
Examples
Destructive
Tints the icon with the destructive color for errors.
Without icon
A title and description with no leading icon.
Title only
An icon with a single line of text and no description.
With action
Places a small button in the top-end corner with AlertAction.
API Reference
Alert
The container that lays out the icon, text and action.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "destructive" | "default" | Icon color. default uses text-primary; destructive uses text-destructive. |
Also accepts the props of React.ComponentProps<"div">.
AlertTitle
The bold headline of the message.
Also accepts the props of React.ComponentProps<"div">.
AlertDescription
Secondary text that explains the message.
Also accepts the props of React.ComponentProps<"div">.
AlertAction
An absolutely positioned slot for a button or link in the top-end corner.
Also accepts the props of React.ComponentProps<"div">.
Accessibility
Alertrenders withrole="alert", so assistive technology announces its content when it appears.- Interactive content in
AlertActionstays in the normal tab order. - Decorative icons should not need a label; put the meaning in the title text.
Notes
- Styling hooks:
data-slot="alert","alert-title","alert-description"and"alert-action". - Both variants use
bg-muted; they differ only in icon color (text-primaryortext-destructive). - Links inside the title or description are underlined automatically.

Alert is a View on a rounded bg-muted surface with an optional leading icon, a title and description column, and an optional action pinned to the top-end corner. It is static and stays in the layout; it is not a toast or a modal.
Use the default variant for neutral information, where the icon uses the primary color, and destructive for errors, where the icon uses the destructive color.
Installation
The CLI also adds what it builds on: Icon, Text.
Manual
-
Target iOS 17 or later.
-
Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Set
minSdkto 24 or higher and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Pass a Phosphor icon component to icon, and compose AlertTitle and AlertDescription as children. Any AlertAction child is detected and placed in the corner, and extra end padding is added so the text does not run under it.
Use iconClassName to adjust the icon's size or color.
Examples
Destructive
The destructive variant with a destructive-colored icon.

Title only
An alert with only a title.

With action
An AlertAction button in the top-end corner.

Without icon
An alert with text only and no icon.
API Reference
Alert
Container with the icon, text column and action.
| Prop | Type | Default | Description |
|---|---|---|---|
icon | PhosphorIcon | - | Phosphor icon component shown before the text. |
variant | "default" | "destructive" | "default" | default or destructive; changes the icon color. |
iconClassName | string | - | Extra classes for the icon. |
Also accepts the props of React.ComponentProps<typeof View>, React.RefAttributes<View>.
AlertTitle
Bold first line.
Also accepts the props of React.ComponentProps<typeof Text>.
AlertDescription
Secondary-colored supporting text.
Also accepts the props of React.ComponentProps<typeof Text>.
AlertAction
Slot positioned in the top-end corner.
Also accepts the props of React.ComponentProps<typeof View>, React.RefAttributes<View>.
Accessibility
- The container has the
alertrole. - The icon is decorative; put the meaning in the title or description.
Notes
- Uses
bg-muted,text-foreground,text-primaryandtext-destructivetokens; light and dark follow the system appearance. - The action is positioned with
end-4, so it flips in right-to-left layouts.



