Alert

Feedback

Displays 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.

Default

Error

Something went wrong.

Destructive

Success

Your changes have been saved.

Success

Warning

Your account is about to expire.

Warning

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

NameTypeDescription
iconIconNameIcon to display in the alert
title&strAlert title text
description&strAlert description text
variantAlertVariantVisual variant of the alert
tokens&DesignTokensDesign 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