Skip to content

Alert

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/alert.css'
import '@timelessui/components/css/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, alert.css, 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.

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.