# Button

> Native ref-forwarding action control with primary, ghost, outline and danger variants.

- Group: Core
- Status: stable
- Aliases: btn, cta
- HTML page: https://design.ipmnx.com/components/button/
- Spec: https://design.ipmnx.com/design/#nx-button

## Preview

**Variants** Primary, ghost, danger, small.

```html
<button class="nx-btn nx-btn--primary">Save</button>
<button class="nx-btn nx-btn--ghost">Cancel</button>
<button class="nx-btn nx-btn--danger nx-btn--sm">Delete</button>
```

```tsx
<NxButton variant="primary">Save</NxButton>
<NxButton variant="ghost">Cancel</NxButton>
<NxButton className="nx-btn--danger nx-btn--sm">Delete</NxButton>
```

## API

### React props (NxKit)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `variant` | `"primary"\|"ghost"\|"outline"\|"danger"` | `"primary"` |   | Visual weight and destructive-action styling. |
| `size` | `"sm"\|"md"\|"lg"\|"icon"` | `"md"` |   | Shared control dimensions; icon buttons still need an accessible name. |

### Classes

| Class | Description |
| --- | --- |
| `.nx-btn` | Base |
| `.nx-btn--primary` | Accent fill |
| `.nx-btn--ghost` | Outline |
| `.nx-btn--danger` | Destructive, solid-fill token |
| `.nx-btn--sm` | Small size cut |

## States

### disabled

```html
<button class="nx-btn nx-btn--primary" disabled>Save</button>
```

### loading

```html
<button class="nx-btn nx-btn--primary" aria-busy="true" aria-label="Saving"><span class="nx-btn__label">Saving</span><span class="nx-spinner" aria-hidden="true"></span></button>
```

## Accessibility

- Native `<button>`; :focus-visible ink outline; :disabled dims + not-allowed cursor.
- Loading state: wrap the label in .nx-btn__label + add a .nx-spinner child and aria-busy="true" plus an aria-label describing the pending action.

## Do / Don't

- Do: Use one primary per view.
- Don't put accent-600 text on an accent-50 fill.

## Related

- [Icon button](https://design.ipmnx.com/components/icon-button.md)

---

Source: registry.js (NX Design System)
