Glin UI
Primitive / Molecule

Alert

Contextual feedback message with default, glass, outline, and ghost variants.

Edit on GitHub

Installation

Install from
pnpm dlx @glinui/cli@latest add alert

Prefer the package?

Usage

Variants

glinr is the default. plain is flat shadcn. glass is opt-in and needs a backdrop.

import { Alert } from "@glinui/ui"
<Alert variant="glinr" tone="accent" icon />
<Alert variant="plain" tone="accent" icon />
<Alert variant="solid" tone="accent" icon />
<Alert variant="soft" tone="accent" icon />
<Alert variant="glass" tone="accent" icon />

Dismissible and quiet looks

A banner you can dismiss, plus the note and flag looks for low-key asides.

import { useState } from "react"
import { ArrowClockwise } from "@phosphor-icons/react"
import { Alert, AlertDescription, AlertTitle, Button } from "@glinui/ui"
export function Demo() {
const [open, setOpen] = useState(true)
return (
<div className="flex w-full max-w-xl flex-col gap-3">
{open ? (
<Alert tone="accent" icon>
<AlertTitle>Invite your team</AlertTitle>
<AlertDescription>Projects with two or more members ship twice as often.</AlertDescription>
<div className="mt-3 flex flex-wrap gap-2">
<Button size="sm">Invite teammates</Button>
<Button size="sm" variant="ghost" onClick={() => setOpen(false)}>Dismiss</Button>
</div>
</Alert>
) : (
<Button variant="outline" size="sm" className="w-fit" onClick={() => setOpen(true)}>
<ArrowClockwise aria-hidden className="size-4" />
Show banner again
</Button>
)}
<Alert variant="note">
<AlertTitle>Note</AlertTitle>
<AlertDescription>Quiet aside for tips that do not need a tone.</AlertDescription>
</Alert>
<Alert variant="flag">
<AlertTitle>Flag</AlertTitle>
<AlertDescription>Brand-colored callout for launches and announcements.</AlertDescription>
</Alert>
</div>
)
}

In a layout

A billing warning above a plan card.

Team plan

Active

5 seats, billed monthly.

$60per month
import {
Alert,
AlertDescription,
AlertTitle,
Badge,
Button,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle
} from "@glinui/ui"
export function Demo() {
return (
<section aria-label="Billing settings" className="flex w-full max-w-xl flex-col gap-4">
<Alert tone="warning">
<AlertTitle>Your card expires next month</AlertTitle>
<AlertDescription>Update it before Nov 1 to avoid a failed renewal.</AlertDescription>
<div className="mt-3">
<Button size="sm" variant="outline">Update card</Button>
</div>
</Alert>
<Card>
<CardHeader>
<div className="flex items-center justify-between gap-3">
<CardTitle>Team plan</CardTitle>
<Badge tone="success" variant="soft" dot>Active</Badge>
</div>
<CardDescription>5 seats, billed monthly.</CardDescription>
</CardHeader>
<CardContent className="flex items-baseline gap-1">
<span className="text-3xl font-semibold">$60</span>
<span className="text-sm text-[var(--color-muted)]">per month</span>
</CardContent>
</Card>
</section>
)
}

Surface Styles

import { Alert, AlertTitle, AlertDescription } from "@glinui/ui"
import { Bell } from "@phosphor-icons/react"

export function AlertSurfaceDemo() {
  return (
    <div className="space-y-3">
      <Alert variant="default">
        <Bell className="size-4" />
        <AlertTitle>Default Surface</AlertTitle>
        <AlertDescription>Balanced contrast for standard inline system messaging.</AlertDescription>
      </Alert>
      <Alert variant="glass">
        <Bell className="size-4" />
        <AlertTitle>Glass Surface</AlertTitle>
        <AlertDescription>Frosted treatment for elevated cards and overlays.</AlertDescription>
      </Alert>
      <Alert variant="matte">
        <Bell className="size-4" />
        <AlertTitle>Matte Surface</AlertTitle>
        <AlertDescription>Dense, low-glare treatment for high-density dashboards.</AlertDescription>
      </Alert>
      <Alert variant="outline">
        <Bell className="size-4" />
        <AlertTitle>Outline Surface</AlertTitle>
        <AlertDescription>Low-emphasis bordered message without strong fill.</AlertDescription>
      </Alert>
    </div>
  )
}

Sizes

import { Alert, AlertTitle, AlertDescription } from "@glinui/ui"

export function AlertSizeDemo() {
  return (
    <div className="space-y-3">
      <Alert size="sm"><AlertTitle>Small</AlertTitle><AlertDescription>Compact alert.</AlertDescription></Alert>
      <Alert size="md"><AlertTitle>Medium</AlertTitle><AlertDescription>Standard alert.</AlertDescription></Alert>
      <Alert size="lg"><AlertTitle>Large</AlertTitle><AlertDescription>Expanded alert.</AlertDescription></Alert>
    </div>
  )
}

Note and flag

note is a raised callout. flag adds a violet ring and violet title.

import { Alert, AlertDescription, AlertTitle } from "@glinui/ui"

export function Demo() {
  return (
    <div className="grid gap-3">
      <Alert variant="note"><AlertTitle>Note</AlertTitle><AlertDescription>Keys rotate every 90 days.</AlertDescription></Alert>
      <Alert variant="flag"><AlertTitle>Self-hosted only</AlertTitle><AlertDescription>Not available on cloud.</AlertDescription></Alert>
    </div>
  )
}

Accessibility

  • Uses `role="alert"` by default.
  • Keep alert text concise and actionable.
  • Prefer one alert per context region.
  • Root component uses `role="alert"` by default.
  • Prefer one alert per context region to avoid screen reader noise.

ARIA Attributes

  • `role="alert"` native
  • `aria-live="assertive"`

Reduced Motion

Alert is static and does not rely on animation.

API Reference

Alert

PropTypeRequiredDefaultDescription
variantAlertVariant | nullNoambient (glinr)Surface look. Omitted follows the ambient design style. Glass is opt-in.
toneSurfaceToneNoneutralAccent bar, tint and icon color.
iconboolean | React.ReactNodeNo-true renders the tone icon, a node renders a custom icon, false hides it. A non-neutral tone shows its icon by default.
size"sm" | "md" | "lg"NomdPadding density.
rolestring-alertARIA role.

AlertTitle

PropTypeRequiredDefaultDescription
classNamestring--Additional class names.
iconboolean | React.ReactNodeNo-`true` renders the tone icon, a node renders a custom icon, `false` hides it. Defaults to the tone icon when a non-neutral `tone` is set.
size"sm" | "md" | "lg"No"md"Variant option from alertSizeVariants.
toneSurfaceToneNo-Tone for the accent bar, tint and icon.
variantAlertVariant | nullNo-Surface look. Omitted follows the ambient style (glinr by default, plain for minimal). Vocabulary: glinr, solid, plain, soft, outline, ghost, gradient, glass. Legacy names (default, destructive, success, warning, info, liquid, matte, glow, note, flag) keep working.

AlertDescription

PropTypeRequiredDefaultDescription
classNamestring--Additional class names.
iconboolean | React.ReactNodeNo-`true` renders the tone icon, a node renders a custom icon, `false` hides it. Defaults to the tone icon when a non-neutral `tone` is set.
size"sm" | "md" | "lg"No"md"Variant option from alertSizeVariants.
toneSurfaceToneNo-Tone for the accent bar, tint and icon.
variantAlertVariant | nullNo-Surface look. Omitted follows the ambient style (glinr by default, plain for minimal). Vocabulary: glinr, solid, plain, soft, outline, ghost, gradient, glass. Legacy names (default, destructive, success, warning, info, liquid, matte, glow, note, flag) keep working.

Source

Import directly from the package or browse the source on GitHub. Click any file to view it.

Import

import { Alert } from "@glinui/ui"

Source Files

Dependencies

@glinui/ui

Generated API Snapshot

Beta

Auto-extracted from TypeScript source in packages/ui/src/components/alert.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.

Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata

Primary Props Type

AlertProps

AlertProps

PropTypeRequiredDefaultDescription
iconboolean | React.ReactNodeNo-`true` renders the tone icon, a node renders a custom icon, `false` hides it. Defaults to the tone icon when a non-neutral `tone` is set.
size"sm" | "md" | "lg"No"md"Variant option from alertSizeVariants.
toneSurfaceToneNo-Tone for the accent bar, tint and icon.
variantAlertVariant | nullNo-Surface look. Omitted follows the ambient style (glinr by default, plain for minimal). Vocabulary: glinr, solid, plain, soft, outline, ghost, gradient, glass. Legacy names (default, destructive, success, warning, info, liquid, matte, glow, note, flag) keep working.