Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Information with Icon Alert Dialog for Svelte

An informational dialog with an info icon beside New Features Available and a single button labeled Got it.

UI library: Ark UI

An info icon sits beside New Features Available, and it is hidden from assistive tech. The text mentions new collaboration features. Got it is the only button. It does not open another page.

Use one button when the reader only needs to acknowledge the note. A note that should stay visible is an Alert. In Svelte, Ark UI does not track who dismissed it.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Alert Dialog anatomy: content, title, description, cancel, action

Usage

<AlertDialog><AlertDialogTrigger>{#snippet asChild(props)}<Button {...props()} variant="outline">Show Info</Button>{/snippet}</AlertDialogTrigger><AlertDialogContent><AlertDialogHeader><div class="flex items-center gap-2"><InfoIcon aria-hidden="true" class="size-5 text-info" /><AlertDialogTitle>New Features Available</AlertDialogTitle></div><AlertDialogDescription>We've added new collaboration features to help your team work more efficiently. Check out the what's new page to learn more.</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter><AlertDialogClose>{#snippet asChild(props)}<AlertDialogAction {...props()}>Got it</AlertDialogAction>{/snippet}</AlertDialogClose></AlertDialogFooter></AlertDialogContent></AlertDialog>

FAQ

What color should an info icon be?

text-info, the theme's blue for neutral information. Keep destructive, success and warning colors for messages with that weight.

Beside the title or above it?

Beside it, in a flex items-center gap-2 row, for routine information. Center it above the title for messages that need more attention.

What size?

size-5 matches the title text.

Can different messages use different icons?

Yes, consistently: info for general notes, a lightbulb for tips, a bell for notifications. People learn the system.

Does the icon need a label?

No. It's decorative and aria-hidden, because the title says New Features Available. Label an icon only when it carries meaning the text doesn't.

Does Got it close the dialog?

Yes.

API Reference

Alert Dialog

Sets props. The rest is on the Alert Dialog page.

Button

Sets props and variant="outline". The rest is on the Button page.