Alert

A feedback surface, from an inline notice to a page banner. Compose it from parts, like Card.

dismissible · animates away, then unmounts

banner · full-bleed, edge to edge (no rounding)

collapsible detail · nests the existing Collapsible, not a bespoke prop

Colors & structure

Sizes

Glass · notice floating over a colored background

Using Alert

Silica ships one design system through three paths. They share a class vocabulary but are not interchangeable — pick the one that matches what you are building.

Plain HTML — CSS classes

The Tailwind v4 plugin. Works in any framework or none — Rails, Django, PHP, Go, a static file. This path is complete for Alert — it needs no JavaScript, so the classes below are the whole story.

/* in your CSS */
@import "tailwindcss";
@plugin "@wizeworks/silicaui";

Root class alert, with 25 modifiers:

  • .alert
  • .alert-accent
  • .alert-actions
  • .alert-banner
  • .alert-close
  • .alert-content
  • .alert-dash
  • .alert-description
  • .alert-dismiss
  • .alert-dismiss-inner
  • .alert-error
  • .alert-ghost
  • .alert-info
  • .alert-lg
  • .alert-md
  • .alert-neutral
  • .alert-outline
  • .alert-primary
  • .alert-secondary
  • .alert-sm
  • .alert-soft
  • .alert-success
  • .alert-title
  • .alert-warning
  • .alert-xl
  • .alert-xs

React

Typed components over those same classes, with behavior and accessibility from Base UI.

npm i @wizeworks/silicaui-react
import { Alert } from "@wizeworks/silicaui-react";

Props

PropTypeRequiredDescription
colorAlertColornoSemantic color; maps to alert-<color>. Omit for a neutral surface.
variantAlertVariantnoVisual style. Default solid.
sizeAlertSizenoDefault md.
bannerbooleannoFull-bleed "page banner" placement — edge to edge, no rounding.
dismissiblebooleannoShow a dismiss (×) button and animate the alert away on close.
openbooleannoControlled open state (only meaningful with dismissible).
defaultOpenbooleannoUncontrolled initial open state. Default true.
onOpenChange(open: boolean) => voidno—
onDismiss() => voidnoFires when the dismiss button is clicked (before onOpenChange).

Source of the demo above

The exact file that renders the examples above, so it can never drift from them. It imports a few of this site’s own layout helpers (../lib/…), so read it for the component calls rather than copying it whole.

Show source
import { useState } from "react";
import {
    Alert,
    AlertContent,
    AlertTitle,
    AlertDescription,
    AlertActions,
    Collapsible,
    CollapsibleTrigger,
    CollapsiblePanel,
    Button,
} from "@wizeworks/silicaui-react";
import { Section, Stack } from "../lib/Section";
import { InfoIcon, CheckIcon, WarnIcon, XIcon } from "../lib/icons";
import { SIZES } from "../lib/data";

export function AlertDemo() {
    const [dismissed, setDismissed] = useState(false);

    return (
        <>
            <Section title="dismissible · animates away, then unmounts">
                <Stack>
                    {!dismissed && (
                        <Alert color="info" dismissible onDismiss={() => setDismissed(true)}>
                            <InfoIcon />A new software update is available.
                        </Alert>
                    )}
                    {dismissed && (
                        <Button size="sm" variant="outline" onClick={() => setDismissed(false)}>
                            Reset
                        </Button>
                    )}
                </Stack>
            </Section>

            <Section title="banner · full-bleed, edge to edge (no rounding)">
                <Alert color="warning" banner dismissible variant="soft">
                    <WarnIcon />
                    Scheduled maintenance tonight at 10pm PT — expect brief downtime.
                </Alert>
            </Section>

            <Section title="collapsible detail · nests the existing Collapsible, not a bespoke prop">
                <Alert color="error" variant="soft">
                    <XIcon />
                    {/* `className="contents"` (a utility, so it wins over the component's
                        own flex-column) keeps AlertContent + AlertActions as direct row
                        children of Alert — the Collapsible only supplies shared open-state
                        context here, not a layout box. That's what lets the icon trigger
                        sit top-right while the label trigger stays under the title, both
                        toggling the one panel. */}
                    <Collapsible className="contents">
                        <AlertContent>
                            <AlertTitle>3 files failed to upload</AlertTitle>
                            <CollapsibleTrigger chevron={false}>Show details</CollapsibleTrigger>
                            <CollapsiblePanel>
                                <ul className="list-disc pl-4 text-xs">
                                    <li>report-q3.pdf — exceeds 5 MB limit</li>
                                    <li>archive.zip — unsupported type</li>
                                    <li>notes.docx — network error</li>
                                </ul>
                            </CollapsiblePanel>
                        </AlertContent>
                        <AlertActions>
                            <CollapsibleTrigger variant="icon" aria-label="Toggle details" />
                        </AlertActions>
                    </Collapsible>
                </Alert>
            </Section>

            <Section title="Colors & structure">
                <Stack>
                    {/* One-liner: leading icon + message */}
                    <Alert color="info">
                        <InfoIcon />A new software update is available.
                    </Alert>
                    <Alert color="success" variant="soft">
                        <CheckIcon />
                        Your changes have been saved.
                    </Alert>
                    {/* Structured: title + description */}
                    <Alert color="warning" variant="soft">
                        <WarnIcon />
                        <AlertContent>
                            <AlertTitle>Storage almost full</AlertTitle>
                            <AlertDescription>
                                You've used 92% of your quota. Consider upgrading.
                            </AlertDescription>
                        </AlertContent>
                    </Alert>
                    {/* Structured + trailing actions (far right, centered) */}
                    <Alert color="error">
                        <XIcon />
                        <AlertContent>
                            <AlertTitle>Upload failed</AlertTitle>
                            <AlertDescription>
                                The file exceeds the 5 MB limit.
                            </AlertDescription>
                        </AlertContent>
                        <AlertActions>
                            <Button size="sm" color="error" variant="soft">
                                Retry
                            </Button>
                        </AlertActions>
                    </Alert>
                    <Alert color="brand" variant="outline">
                        <InfoIcon />
                        The <code>brand</code> color flows through Alerts too.
                    </Alert>
                    <Alert>
                        <InfoIcon />
                        Neutral alert — no color prop, just the base surface.
                    </Alert>
                </Stack>
            </Section>

            <Section title="Sizes">
                <Stack className="gap-2">
                    {SIZES.slice(0, 4).map((size) => (
                        <Alert key={size} color="info" size={size}>
                            <InfoIcon />
                            {size}
                        </Alert>
                    ))}
                </Stack>
            </Section>

            <Section title="Glass · notice floating over a colored background">
                <div
                    className="rounded-box p-8"
                    style={{
                        backgroundImage:
                            "linear-gradient(135deg, var(--color-primary), var(--color-accent), var(--color-secondary))",
                    }}
                >
                    <Stack className="gap-3">
                        <Alert className="glass">
                            <InfoIcon />A new software update is available.
                        </Alert>
                        <Alert color="success" className="glass">
                            <CheckIcon />
                            Your changes have been saved.
                        </Alert>
                        <Alert color="error" className="glass">
                            <XIcon />
                            <AlertContent>
                                <AlertTitle>Upload failed</AlertTitle>
                                <AlertDescription>
                                    The file exceeds the 5 MB limit — glass still reads clearly
                                    at error severity.
                                </AlertDescription>
                            </AlertContent>
                            <AlertActions>
                                <Button size="sm" color="error" variant="soft">
                                    Retry
                                </Button>
                            </AlertActions>
                        </Alert>
                    </Stack>
                </div>
            </Section>
        </>
    );
}

Vanilla — node tree to HTML

Alert — a role="alert" surface; its children (or text prop) sit in the flex row. Build a node tree, project it with toHtml(), and let the zero-dependency runtime hydrate it. This is the path for generated or user-authored documents — a site builder, CMS output, a static export.

npm i @wizeworks/silicaui-html @wizeworks/silicaui-behaviors
import { atom, toHtml } from "@wizeworks/silicaui-html";

const node = atom("Alert", "alert", { /* props */ });
const markup = toHtml(node);

Styling on this path is the class string in the second argument — the same classes as the Plain HTML section above. There is no color prop here; write "alert alert-primary" rather than passing a colour as a prop.

Takes children
no
Hydrated by
nothing — this one is static markup

The full API for Alert, on every path, is available through the Silica MCP server.