Browse docsAlert

FeedbackNew

Glass Alert

A tinted glass message with four tones, an icon and an optional dismiss button.

Preview

Heads up

Your trial ends in three days.

Saved

Every change is in.

Demos ready. Update 0.

Installation

For React 19+ apps with Tailwind CSS 4.

npx shadcn@4.14.1 add @glassyui/glass-alert

Adds 5 files to components/glassyui and installs clsx.

Usage

Usage

import { GlassAlert } from "@/components/glassyui/glass-alert";

export function TrialAlert() {
  return <GlassAlert title="Heads up">Your trial ends in three days.</GlassAlert>;
}

Examples

Tones

<GlassAlert tone="success" title="Saved">Every change is in.</GlassAlert>
<GlassAlert tone="warning" title="Almost full">92% of your storage is used.</GlassAlert>
<GlassAlert tone="danger" title="Payment failed">Update your card.</GlassAlert>
Dismissible

<GlassAlert title="New version" onDismiss={() => setShown(false)}>
  Reload to get it.
</GlassAlert>

API reference

GlassAlert

className, ref and other props reach the inner alert. Space stacked dismissible alerts with margin, not a parent gap, so the space folds away with them.

PropTypeDefaultDescription
tone'info' | 'success' | 'warning' | 'danger''info'Colour, icon and announcement role.
titleReactNodeNoneA bold line above the message.
iconReactNode | falsetone iconReplaces the tone's decorative icon; false shows none.
onDismiss() => voidNoneShows a close button and runs after the alert folds away; remove the alert here and give each alert a stable key.
dismissLabelstring'Dismiss'Accessible name of the close button.
rolestring'alert' for warning and danger, else 'status'Overrides the announcement role.

Also accepts HTML div attributes, with title replaced.

Types
GlassAlertPropsGlassAlertTone
Accessibility
warning and danger use role alert and interrupt screen readers, while info and success use role status; pass role to change that.