Skip to main content
GitHub

alert

error and warning use role="alert" — screen readers announce them immediately. info and success use role="status" for a polite announcement.

Your account is pending email verification.
Saved Your changes have been saved.
alert({ variant: 'info',    message: 'Your account is pending email verification.' })
alert({ variant: 'success', title: 'Saved',    message: 'Your changes have been saved.' })
alert({ variant: 'warning', title: 'Heads up', message: 'This action cannot be undone.' })
// message is plain text and is escaped for you: use it for anything from a user, a form or an error.
// items are lines under the message, escaped; give a line an href to make it a link.
alert({ variant: 'error',   title: 'Fix these', items: [{ text: 'Email is required', href: '#email' }, { text: 'Message is too long', href: '#message' }] })
// content is an HTML string you wrote and is not escaped.
alert({ variant: 'error',   title: 'Failed',   message: server.error })
alert({ variant: 'info',    content: '<a href="/help">Read the guide</a>' })