Installation
npx shadcn@latest add @iconiq/alertProps
Alert
7 props
Default export for a single dismissible notice. It can render inline with surrounding content or portal to the viewport when you provide a position.
icon
ReactNodeRequired
Leading visual passed straight into the icon slot. The wrapper applies fallback sizing to nested SVGs so Lucide icons land around 18px without extra setup.
title
stringRequired
Primary line rendered in the stronger label style.
message
stringRequired
Secondary copy rendered below the title with a lighter foreground tone.
dismissible
booleanDefault
trueControls whether the close button is rendered. Disabling it removes manual dismissal only; timeout still applies unless it is set to 0.
position
"top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right"When present, the component portals to document.body and uses fixed positioning classes. When omitted, the alert stays in normal flow and maxes out at max-w-sm.
timeout
numberDefault
10000Auto-dismiss delay in milliseconds. Passing 0 disables the timer and removes the progress-bar countdown.
onDismiss
() => voidCalled after the component marks itself hidden, regardless of whether dismissal came from the close button or the timeout effect.
Notes
Every positioned alert snaps to a full-width top placement on small screens, then switches to the requested corner at the sm breakpoint.
The alert keeps its own visible state internally, so it is designed for fire-and-forget notifications rather than parent-controlled open state.