# Table

> Bordered data table with a tinted header, row hover, and empty/loading/selected states.

- Group: Data
- Status: stable
- Aliases: data-table
- HTML page: https://design.ipmnx.com/components/table/
- Spec: https://design.ipmnx.com/design/#nx-table

## Preview

**Jobs table**

```html
<div class="nx-table__wrap">
  <table class="nx-table">
    <thead>
      <tr>
        <th>Job</th>
        <th>Customer</th>
        <th>Status</th>
        <th class="num">Value</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td style="font-variant-numeric:tabular-nums;
            color:var(--nx-slate-500)">#4412</td>
        <td>Nordküste: window clean</td>
        <td>
          <span class="nx-badge nx-badge--soft">On site</span>
        </td>
        <td class="num">€380</td>
      </tr>
    </tbody>
  </table>
</div>
```

```tsx
<NxTable>
  <thead>
    <tr>
      <th>Job</th><th>Customer</th><th>Status</th>
      <th className="num">Value</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>#4412</td><td>Nordküste: window clean</td>
      <td><NxBadge variant="soft">On site</NxBadge></td>
      <td className="num">€380</td>
    </tr>
  </tbody>
</NxTable>
```

## API

### React props (NxKit)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `wrap` | `boolean` | `true` |   | Wraps the table in the rounded .nx-table__wrap card; set false to compose your own wrapper. |

### Classes

| Class | Description |
| --- | --- |
| `.nx-table` | Base table, uppercase muted th, hairline row rules |
| `.nx-table__wrap` | Rounded bordered card wrapper |
| `.num` | Right-aligned, tabular-nums cell |
| `.nx-table__empty` | Full-width empty-state cell |
| `.nx-table__row--loading` | Skeleton placeholder row |

## States

### empty

```html
<div class="nx-table__wrap"><table class="nx-table"><thead><tr><th>Job</th><th>Customer</th><th class="num">Value</th></tr></thead><tbody><tr class="nx-table__empty"><td colspan="3"><div class="nx-empty"><span class="nx-empty__icon" aria-hidden="true">▤</span><span class="nx-empty__title">No jobs</span><span>Create your first job to get started.</span><button class="nx-btn nx-btn--primary nx-btn--sm" type="button" style="margin-top:8px">Create job</button></div></td></tr></tbody></table></div>
```

### loading

```html
<div class="nx-table__wrap"><table class="nx-table"><caption class="nx-sr-only">Loading jobs</caption><thead><tr><th>Job</th><th>Customer</th><th class="num">Value</th></tr></thead><tbody id="skelRows"></tbody></table></div>
```

### selected row

```html
<div class="nx-table__wrap"><table class="nx-table"><thead><tr><th>Job</th></tr></thead><tbody><tr aria-selected="true"><td>#4412</td></tr></tbody></table></div>
```

## Accessibility

- Give a loading table a visually-hidden `<caption>` announcing the state ("Loading jobs") for screen readers, since skeleton rows carry no text.
- aria-selected="true" on tbody tr pairs with the same inset leading-edge marker as List row, RTL-mirrored. Don't rely on the accent-50 tint alone.

## Do / Don't

- Do: Right-align numeric columns with .num (tabular-nums).
- Don't ship an empty table with no .nx-empty guidance. Always give the next action.

## Related

- [List row](https://design.ipmnx.com/components/list-row.md)
- [Empty state](https://design.ipmnx.com/components/empty-state.md)
- [Skeleton](https://design.ipmnx.com/components/skeleton.md)

---

Source: registry.js (NX Design System)
