# Button

Tactile native actions with clear variants. (CSS only.)

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

## Markup

```html
<button class="ui-button" type="button">Publish component</button>
```

## Install

```js
import '@timelessui/components/css/tokens.css'
import '@timelessui/components/css/core/button.css'
import '@timelessui/components/css/themes/atmosphere/tokens.css'
import '@timelessui/components/css/themes/atmosphere/button.css'
```

## 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` | `primary` · `secondary` · `outline` · `ghost` · `danger` · `danger-outline` · `link` | `primary` | Visual intent. Use `primary` for the main action in a view, `secondary` for neutral actions, `outline` when the action needs a stronger edge, `ghost` for low-emphasis toolbar actions, `danger` and `danger-outline` for destructive actions, and `link` for an action that should read as inline text. |
| `data-ui-size` | `sm` · `md` · `lg` | `md` | Control height, padding, and font size. |

## State

Native attributes, ARIA, and platform pseudo-classes are authoritative. Style state through
the selectors below rather than adding your own state classes.

| State | Source | How to express it |
| --- | --- | --- |
| `disabled` | native | Native `disabled`, or `aria-disabled` on an anchor. |

## Styling

Root identity: `ui-button`.
Required stylesheets: `tokens.css`, `core/button.css`, `themes/atmosphere/tokens.css`, `themes/atmosphere/button.css`.

Set these custom properties to restyle the component:

| Custom property | Controls |
| --- | --- |
| `--ui-button-bg` | Resting background. |
| `--ui-button-bg-hover` | Hover background. |
| `--ui-button-bg-active` | Active background. |
| `--ui-button-fg` | Label color. |
| `--ui-button-fg-hover` | Hover label color. |
| `--ui-button-border` | Border color. |
| `--ui-button-shadow` | Resting shadow. |
| `--ui-button-shadow-hover` | Hover shadow. |
| `--ui-button-shadow-active` | Active shadow. |
| `--ui-button-height` | Minimum block size. |
| `--ui-button-padding-x` | Inline padding. |
| `--ui-button-gap` | Gap between icon and label. |
| `--ui-button-radius` | Corner radius. |

Design tokens this component reads (20), global and set at the theme level: `--ui-accent`, `--ui-bg-accent`, `--ui-bg-accent-active`, `--ui-bg-accent-hover`, `--ui-bg-control`, `--ui-bg-control-active`, `--ui-bg-control-hover`, `--ui-bg-control-muted`, `--ui-bg-danger`, `--ui-bg-danger-active`, `--ui-bg-danger-hover`, `--ui-duration-fast`, `--ui-ease-standard`, `--ui-fg`, `--ui-focus`, `--ui-radius-control`, `--ui-shadow-control-accent`, `--ui-shadow-control-active`, `--ui-shadow-control-danger`, `--ui-shadow-outline-control`.

## 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.

This component declares no keyboard contract, because it has none of its own: the markup above
is native elements and native ARIA, and everything a keyboard or a screen reader does with it
comes from the platform. Nothing here manages focus, and nothing here adds a role you did not
author. So the accessibility of this component is the accessibility of the markup — which is why
the markup is the part worth copying exactly.

## Before JavaScript runs

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