Alert
FeedbackDisplays a callout with icon, title, and description for important messages.
Preview
Heads up!
You can use Floe UI components in any Iced app.
Error
Your session has expired. Please log in again.
Variants
Information
This is a default alert.
Error
Something went wrong.
Success
Your changes have been saved.
Warning
Your account is about to expire.
Usage
alert.rs
use floe_ui::components::alert::{self, AlertVariant};
use floe_ui::components::icon::IconName;
"text-zinc-500">// Default info alert
let info = alert::info("Heads up!", "You can use Floe UI components.", &tokens);
"text-zinc-500">// Error alert
let error = alert::error("Error", "Session expired.", &tokens);
"text-zinc-500">// Success alert
let success = alert::success("Success", "Changes saved.", &tokens);
"text-zinc-500">// Warning alert
let warning = alert::warning("Warning", "Account expiring.", &tokens);
"text-zinc-500">// Custom alert with specific icon and variant
let custom = alert::styled(
IconName::Info,
"Custom Title",
"Custom description text.",
AlertVariant::Default,
&tokens,
);API Reference
Props / Parameters
| Name | Type | Description |
|---|---|---|
| icon | IconName | Icon to display in the alert |
| title | &str | Alert title text |
| description | &str | Alert description text |
| variant | AlertVariant | Visual variant of the alert |
| tokens | &DesignTokens | Design tokens for theming |
Style Functions
alert_style(tokens, variant)
Style functions return closures compatible with Iced's .style() method.
Builder Functions
styled(icon, title, description, variant, tokens)
info(title, description, tokens)
error(title, description, tokens)
success(title, description, tokens)
warning(title, description, tokens)
Builder functions return pre-configured Iced widgets ready for use.
Source: floe-ui/src/components/alert.rs