Skip to main content

Announcement

The announcement component surfaces short, high-visibility messages at checkout without blocking the flow. Use announcement for promotions, shipping updates, and lightweight prompts that keep buyers moving.

Announcements support links, optional dismissal, and can trigger a modal for longer-form content. For persistent status messages or error alerts, use banner instead.

The announcement bar enforces a strict maximum height. Content beyond that height is truncated and can't scroll. Layout and content are controlled entirely through child elements.

Support
Targets (1)

The announcement component provides event callbacks for handling user interactions. Learn more about handling events.

Anchor to aftertoggle
aftertoggle
<typeof tagName, >

A callback that fires when the element state changes, after any toggle animations have finished.

  • If the element transitioned from hidden to showing, the oldState property will be set to closed and the newState property will be set to open.
  • If the element transitioned from showing to hidden, the oldState property will be set to open and the newState will be closed.

Learn more about newState property and oldState property.

Anchor to dismiss
dismiss
<typeof tagName>

A callback that fires when the announcement is dismissed by the user clicking the close button or by calling the dismiss() method programmatically.

Anchor to toggle
toggle
<typeof tagName, >

A callback that fires immediately when the element state changes, before any animations.

  • If the element is transitioning from hidden to showing, the oldState property will be set to closed and the newState property will be set to open.
  • If the element is transitioning from showing to hidden, then the oldState property will be set to open and the newState will be closed.

Learn more about the toggle event, newState property, and oldState property.

The announcement component exposes methods for programmatic control. Learn more about using methods.

Anchor to dismiss
dismiss
() => void
required

Programmatically dismisses the announcement. This triggers the dismiss event callback.


Anchor to Display a promotional announcementDisplay a promotional announcement

Display a promotional announcement with a survey link. This example shows an s-announcement with inline text and a link inviting buyers to fill out a survey.

Display a promotional announcement

A rendered example of the announcement component

html

<s-announcement>
Enjoy a free plant on us! 🌿 We'd love to hear from you. <s-link href="/survey">Fill out the survey</s-link>
</s-announcement>

Use an announcement as a teaser that opens a modal for longer-form content. This example displays a short prompt with an s-link that triggers a survey modal.

html

<s-announcement>
Enjoy a free plant on us! 🌿 We'd love to hear from you. <s-link href="/survey">Fill out the survey</s-link>
</s-announcement>

Anchor to Display an announcement with plain textDisplay an announcement with plain text

Keep the body to a single s-text element. This example places one s-text inside s-announcement without stacks or other layout wrappers.

html

<s-announcement>
<s-text>Free shipping on orders over $50, and you qualify!</s-text>
</s-announcement>

  • Keep copy short: Fit the message in a single short line whenever possible so buyers see it at a glance without needing to expand.
  • Plan for truncation: The component has a strict maximum height. Content that exceeds the expanded state's height is clipped with no scrolling. Validate your copy length before shipping.
  • Link to a modal for longer content: If you need to display surveys, detailed offers, or other long-form content, use the announcement bar as a teaser that opens a modal rather than overfilling the bar.

Was this page helpful?