DataTable
Sort dates and amounts, reconcile subtotals and print an accounting ledger.
alpina-ui/ui/data-table| Work | Booked | Amount (CHF) |
|---|---|---|
| Prepress | ||
| Cover proofs | 480.00 | |
| Plate credit | minus 32.50 | |
| Prepress subtotal | 447.50 | |
| Printing | ||
| Press run | 1’280.50 | |
| Binding | 96.00 | |
| Printing subtotal | 1’376.50 | |
| Invoice total | 1’824.00 | |
Usage notes
An invoice link labelled 2026-0141 stays on one line automatically. Set nowrap: true on the column for a custom link containing nested markup, or nowrap: false to allow wrapping. Use typed CHF, decimal and Swiss date columns to sort records. Use aggregate="sum", groupBy and totalLabel for totals and subtotals.
When to use
Let readers reorder comparable records, such as invoices by due date or amount.
When to avoid
A fixed tariff schedule with a prescribed reading order only needs Table.
Accessibility
Use the sort button inside the header, expose its direction and translate the sort hint. Compare dates and amounts by their underlying values.
| Key | Action |
|---|---|
| Tab / Shift+Tab | Move to sortable column headings and other controls. |
| Enter / Space | Sort by the focused column. Activate again to reverse the order. |
| ← / → | Scroll wide content while its scroll region has focus. |
Content
Use the field name as the header, with the unit when needed. Put the sorting instruction in the hint instead of repeating it in every heading.
- Use
- Due date
- Avoid
- Click here to sort this column
Copy in four languages
- German
- Fälligkeit10 characters
- French
- Échéance8 characters
- Italian
- Scadenza8 characters
- Romansh
- Scadenza8 characters
npx --no-install alpina add data-table