Skip to content
This is a note variant - great for general information.
This is a tip variant - perfect for positive news!
This is a caution variant - use for warnings.
This is a danger variant - for critical alerts!

Variants Demo

This page demonstrates all four announcement variants. Look at the top of the page to see each variant in action.

The announcements at the top of this page showcase:

  1. Note (Blue): General information and updates
  2. Tip (Green): Positive news and helpful tips
  3. Caution (Orange): Warnings and deprecation notices
  4. Danger (Red): Critical alerts and breaking changes

These announcements are configured with the showOn option targeting this specific page:

starlightAnnouncement({
displayMode: 'stack',
announcements: [
{
id: 'demo-note',
content: 'This is a <strong>note</strong> variant - great for general information.',
variant: 'note',
showOn: ['/demos/variants/'],
},
{
id: 'demo-tip',
content: 'This is a <strong>tip</strong> variant - perfect for positive news!',
variant: 'tip',
showOn: ['/demos/variants/'],
},
{
id: 'demo-caution',
content: 'This is a <strong>caution</strong> variant - use for warnings.',
variant: 'caution',
showOn: ['/demos/variants/'],
},
{
id: 'demo-danger',
content: 'This is a <strong>danger</strong> variant - for critical alerts!',
variant: 'danger',
showOn: ['/demos/variants/'],
},
],
})

The variants use Starlight’s built-in color variables for consistency with the aside component:

VariantBackgroundBorderUse Case
note--sl-color-blue-low--sl-color-blueInformation, updates
tip--sl-color-green-low--sl-color-greenSuccess, tips
caution--sl-color-orange-low--sl-color-orangeWarnings
danger--sl-color-red-low--sl-color-redCritical alerts
  • Dismiss any announcement by clicking the X button
  • Refresh the page to see dismissed announcements again (after clearing localStorage)

See Announcement Options for detailed documentation on variants.