Skip to content
daisyBlazor

Alert

A daisyUI alert banner coloured by Severity, with a matching icon added for you. Use it for messages that stay on the page; reach for Snackbar when the message should come and go.
Feedback.alertReplaces MudAlert
Cover · <Alert>
Staging deploy passed.
Database maintenance runs Friday.

Examples

Severities

Normal, Info, Success, Warning and Error map to the theme's alert colours and pick a fitting icon.

Your workspace was last synced 4 minutes ago.
Acme Cloud 2.4 is available.
Invoice INV-1042 has been paid.
website/Examples/Feedback/AlertSeveritiesExample.razor Source

Variants

Filled is the default; Text gives daisyUI's soft tint and Outlined keeps only the border.

Filled: the default, strongest emphasis.
Text: a soft tint for quieter notices.
Outlined: a border only, for inline hints.
website/Examples/Feedback/AlertVariantsExample.razor Source

Icons and density

Icon overrides the severity icon, NoIcon removes it, and Dense tightens the padding.

Custom icon: your workspace is ready.
website/Examples/Feedback/AlertIconsExample.razor Source

Playground

Your invoice is on its way.
Severity Severity
Variant Variant
<Alert Severity="Severity.Success">Your invoice is on its way.</Alert>

API

<Alert>

DaisyBlazor

Parameters

  • Dense bool
    = false

    Reduces vertical padding (py-2).

  • Icon string
    = null

    Explicit icon ligature; overrides the severity default when set.

  • NoIcon bool
    = false

    Suppress the leading severity icon.

  • Role string
    = null

    ARIA role of the alert. When null (default), Warning and Error use the assertive alert role and the other severities the polite status role.

  • Severity Severity
    = Severity.Normal

    Alert color (alert-info, alert-success, alert-warning, alert-error) and default icon; Normal is neutral.

  • Variant Variant
    = Variant.Filled

    Filled (default) is solid; Outlined adds alert-outline; Text adds alert-soft.

  • Class string
    = null

    Extra CSS classes added to the alert.

  • Style string
    = null

    Inline CSS style applied to the alert.

Content

  • ChildContent RenderFragment

    Message content rendered next to the icon.

From MudAlert

Alert keeps MudAlert's parameter names, so most markup moves over by dropping the Mud prefix. See the migration guide for the shared enums, icons and services.

<MudAlert> <Alert>
Something went wrong while running the docs. Reload