Examples
Trailing Link
Interactive Dismissible
With Link
Theaction slot is composable: pass any element and it receives the variant-appropriate link styling via Radix Slot. For a Next.js app, pass a router-aware link instead of a plain anchor, e.g. action={<Link href="/changelog">See what's new</Link>} where Link is imported from next/link.
All Variants
Info Closable
Props
Alert
Displays a contextual feedback message to the user. Supportsinfo, success, warning, error, and neutral variants with a default icon per variant, optional title, description, dismiss button, and an optional composable action slot.
Each variant renders a default icon automatically. Pass a custom icon to override, or icon={null} to hide the icon entirely.
Only the title and description live inside the role="alert" live region. The icon, action, and close button are rendered outside it so interactive controls are announced and navigated consistently by screen readers.
ReactNode
Composable action slot rendered beneath the description, outside the
role="alert" live region. Pass your own element (an <a>, a next/link <Link>, or a <Button>) and it receives the variant-appropriate link styling via the Radix Slot pattern while remaining a real link/button.boolean
default:"false"
Whether to show the close button.
string
default:"Close alert"
Accessible label for the close button.
ReactNode
Label for a built-in call-to-action button, the button form of the CTA. Use it when the alert asks the user to do something specific — activating a feature, or completing setup — rather than pointing at more detail. Ignored when
action is set.Omit<ButtonProps, "children" | "asChild">
Props forwarded to the built-in call-to-action button (e.g.
onClick). variant and size default to secondary/32 and can be overridden.The stacked CTA is w-full sm:w-fit. To override the width, match the modifier chain — a bare w-auto replaces w-full but leaves sm:w-fit in place, so pass sm: variants too.ReactNode
Custom icon override. Pass
null to hide the icon entirely. Each variant shows a default icon when left undefined."under" | "trailing"
default:"under"
Placement of the call-to-action relative to the message.
(() => void)
Callback fired when the close button is clicked.
string
Optional title text displayed in bold above the description.
"info" | "success" | "warning" | "error" | "neutral"
default:"info"
Visual style variant of the alert.
Exported types
Also exported from@fanvue/ui: AlertLayout, AlertProps, AlertVariant.
Setup: Installation · Theming