Announcement
The Announcement component provides a less disruptive alternative to auto-open modals for capturing user attention. It provides a standardized way to engage users without being too intrusive.
Support
Targets (1)
Supported targets
- purchase.
thank-you. announcement. render
Supported targets
- purchase.
thank-you. announcement. render
Anchor to eventsEvents
Learn more about registering events.
- Anchor to aftertoggleaftertoggleaftertoggleCallbackEventListener<typeof tagName, ToggleArgumentsEvent>CallbackEventListener<typeof tagName, ToggleArgumentsEvent>
Callback fired when the element state changes after any animations have finished.
- If the element transitioned from hidden to showing, the
property will be set toclosedand theproperty will be set toopen. - If the element transitioned from showing to hidden, the
property will be set toopenand thewill beclosed.
- If the element transitioned from hidden to showing, the
- Anchor to dismissdismissdismissCallbackEventListener<typeof tagName>CallbackEventListener<typeof tagName>
Callback fired when the announcement is dismissed by the user (either via the built-in dismiss button or programmatically).
- Anchor to toggletoggletoggleCallbackEventListener<typeof tagName, ToggleArgumentsEvent>CallbackEventListener<typeof tagName, ToggleArgumentsEvent>
Callback straight after the element state changes.
- If the element is transitioning from hidden to showing, the
property will be set toclosedand theproperty will be set toopen. - If the element is transitioning from showing to hidden, then
property will be set toopenand thewill beclosed.
- If the element is transitioning from hidden to showing, the
CallbackEventListener
(EventListener & {
(event: CallbackEvent<TTagName, Event> & TData): void;
}) | nullCallbackEvent
TEvent & {
currentTarget: HTMLElementTagNameMap[TTagName];
}ToggleArgumentsEvent
- newState
ToggleState - oldState
ToggleState
ToggleState
'open' | 'closed'Anchor to methodsMethods
Learn more about component methods.
- Anchor to dismissdismissdismiss() => void() => voidrequiredrequired
Examples
<s-announcement>
<s-stack direction="inline" gap="base">
<s-text>Check our latest offers</s-text>
<s-link commandFor="modal" command="--show"> Fill out the survey </s-link>
</s-stack>
<s-modal id="modal" heading="Tell us about your shopping experience">
<s-stack gap="base">
<s-text>We'd love to hear about your shopping experience</s-text>
<s-text-area
rows="4"
label="How can we make your shopping experience better?"
></s-text-area>
<s-button>Submit</s-button>
</s-stack>
</s-modal>
</s-announcement>
Preview

Examples
Code
Default
<s-announcement> <s-stack direction="inline" gap="base"> <s-text>Check our latest offers</s-text> <s-link commandFor="modal" command="--show"> Fill out the survey </s-link> </s-stack> <s-modal id="modal" heading="Tell us about your shopping experience"> <s-stack gap="base"> <s-text>We'd love to hear about your shopping experience</s-text> <s-text-area rows="4" label="How can we make your shopping experience better?" ></s-text-area> <s-button>Submit</s-button> </s-stack> </s-modal> </s-announcement>
Anchor to best-practicesBest Practices
- Prioritize the default state: The most effective use of the announcement bar is when content is short enough to display entirely in its default state, with no need for expansion. This provides the best user experience.
- Handle content truncation: The component has a strict maximum height. Content that exceeds the expanded state’s height will be cut off with no scrolling capability. Ensure your application’s logic handles excessively long content gracefully to prevent truncation.
- Provide a modal alternative: If your application needs to display more than a few lines of content, avoid cramming it into the announcement bar. Instead, use the bar as a teaser that links to a modal. This is the recommended pattern for displaying surveys, detailed offers, or other longer-form content.
Was this page helpful?