# Alert

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

Reference: https://timeless.build/docs/components/alert/

## Markup

```html
<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

```js
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. 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.

| Part | Required | Selector | Purpose |
| --- | --- | --- | --- |
| `icon` | No | `[data-ui-part~='icon']` | Decorative status icon. Mark it `aria-hidden="true"`. |
| `content` | No | `[data-ui-part~='content']` | Wrapper for the title and description. |
| `title` | No | `[data-ui-part~='title']` | Short summary line. |
| `description` | No | `[data-ui-part~='description']` | Supporting detail. |
| `actions` | No | `[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.

| Attribute | Values | Default | Description |
| --- | --- | --- | --- |
| `data-ui-variant` | `neutral` · `accent` · `success` · `warning` · `danger` | `neutral` | Status intent. This is styling only — set `role="status"` or `role="alert"` yourself to control how assistive technology announces the message. |
| `data-ui-density` | `compact` · `normal` | `normal` | Internal 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 at https://timeless.build/docs/styling/theming/ or your own CSS.

Design tokens this component reads (23), global and set at the theme level: `--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 markup. 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](https://www.w3.org/WAI/ARIA/apg/patterns/alert/) 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.
