Skip to content

Communicate status without replacing native live-region semantics. CSS only

Alert
Copy this markup
<section class="ui-alert" data-ui-variant="success" role="status">
<div data-ui-part="content">
<h2 data-ui-part="title">Package published</h2>
<p data-ui-part="description">The component is available to downstream apps.</p>
</div>
</section>

Install

Styles and registration
import '@timelessui/components/css/tokens.css'
import '@timelessui/components/css/core/alert.css'
import '@timelessui/components/css/themes/atmosphere/tokens.css'
import '@timelessui/components/css/themes/atmosphere/alert.css'
import '@timelessui/components/css/themes/atmosphere/link.css'

Anatomy

Parts are authored in your own markup and identified by the selector below, so your CSS can target the same anatomy without loading Timeless styles. Required parts must be present for the component to work. Private data-ui-internal-* hooks are written by the runtime and must never be authored.

PartRequiredSelectorPurpose
iconNo[data-ui-part~='icon']Decorative status icon. Mark it aria-hidden="true".
contentNo[data-ui-part~='content']Wrapper for the title and description.
titleNo[data-ui-part~='title']Short summary line.
descriptionNo[data-ui-part~='description']Supporting detail.
actionsNo[data-ui-part~='actions']Container for one or two follow-up actions.

Attributes

Every value below is implemented by the stylesheets this component ships. Boolean attributes are presence-based: author the attribute with no value, or omit it.

AttributeValuesDefaultDescription
data-ui-variantneutral · accent · success · warning · dangerneutralStatus intent. This is styling only — set role="status" or role="alert" yourself to control how assistive technology announces the message.
data-ui-densitycompact · normalnormalInternal spacing.

Styling

Root identity: ui-alert. Required stylesheets: tokens.css, core/alert.css, themes/atmosphere/tokens.css, themes/atmosphere/alert.css, themes/atmosphere/link.css.

This component adds no custom properties of its own. Restyle it through the design tokens or your own CSS.

Design tokens this component reads (23)

These are global Atmosphere tokens. Change them once at the theme level rather than per component.

--ui-accent · --ui-accent-hover · --ui-accent-soft · --ui-bg-surface · --ui-danger · --ui-danger-soft · --ui-duration-fast · --ui-ease-standard · --ui-fg · --ui-fg-muted · --ui-focus · --ui-line · --ui-radius-lg · --ui-radius-xs · --ui-space-1 · --ui-space-2 · --ui-space-3 · --ui-space-4 · --ui-space-5 · --ui-success · --ui-success-soft · --ui-warning · --ui-warning-soft

Accessibility

Keep the native elements, roles, and relationships shown in the example. Timeless adds only the state and keyboard coordination the platform does not already provide, and it never supplies your accessible names — those depend on your content.

Follows the Alert pattern from the ARIA Authoring Practices Guide.

The role is yours to choose, and it depends on when the alert appears. Something rendered with the page is not an alert at all — give it role="status", or no role and a heading, because a live region announces changes and there is no change on first paint. Something inserted in response to what the user just did is a live region: role="status" to wait its turn, role="alert" to interrupt, and the latter only when the message cannot wait. The icon part is decorative and must be hidden from assistive technology; data-ui-variant carries no meaning on its own, so say in the text what the colour implies.

Before JavaScript runs

This primitive is CSS only. There is nothing to register and nothing to wait for.

More examples

Open Alert in StoryLite for variants, controls, and manual testing.