Data display and layout
Table
Data tables with zebra rows, hover rows, compact cells, cell borders, a pinned header and first column, inside a scroll wrapper.
Example
<div class="table-wrap max-h-72"><table class="table table-zebra table-hover table-pin-header table-pin-col"><thead><tr><th>Invoice</th><th>Customer</th><th>Status</th><th>Amount</th></tr></thead><tbody><tr><td>INV-1042</td><td>Northwind</td><td class="text-success">Paid</td><td>$1,250.00</td></tr><tr><td>INV-1043</td><td>Globex</td><td class="text-muted-foreground">Pending</td><td>$860.00</td></tr><tr><td>INV-1044</td><td>Initech</td><td class="text-danger">Overdue</td><td>$2,410.00</td></tr><tr><td>INV-1045</td><td>Umbrella</td><td class="text-success">Paid</td><td>$395.00</td></tr></tbody></table></div>Classes
8 classes. Click a name to copy it. Utilities on the same element always win over component defaults, so any of them can be adjusted with plain utility classes.
| Class | Type | What it does |
|---|---|---|
| Base | Base class of the table. On a <table> in the example. Sets width, border, text size, padding, text style and background, and --table-py and --table-px.CSS |
|
| Part | Part of the table. On a <div> in the example. Sets overflow, border, corner radius and background.CSS |
|
| Modifier | Modifier, combined with the table class. On a <table> in the example. Sets background.CSS |
|
| Modifier | Modifier, combined with the table class. On a <table> in the example. Sets background.CSS |
|
| Modifier | Modifier, combined with the table class. Not used in the example above. Sets --table-py and --table-px.CSS |
|
| Modifier | Modifier, combined with the table class. Not used in the example above. Sets border.CSS |
|
| Modifier | Modifier, combined with the table class. On a <table> in the example. Sets sticky position, offsets and stacking order.CSS |
|
| Modifier | Modifier, combined with the table class. On a <table> in the example. Sets sticky position, offsets, stacking order, background and shadow.CSS |
Usage
Components ship inside the same stylesheet as the utilities. There is nothing else to install and no script to load: link Monsoon and write the markup.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/monsooncss">
<!-- Table: start from the base class, then add modifiers -->
<div class="table-wrap max-h-72"><table class="table table-zebra table-hover table-pin-header table-pin-col"><thead><tr><th>Invoice</th><th>Customer</th><th>Status</th><th>Amount</th></tr></thead><tbody><tr><td>INV-1042</td><td>Northwind</td><td class="text-success">Paid</td><td>$1,250.00</td></tr><tr><td>INV-1043</td><td>Globex</td><td class="text-muted-foreground">Pending</td><td>$860.00</td></tr><tr><td>INV-1044</td><td>Initech</td><td class="text-danger">Overdue</td><td>$2,410.00</td></tr><tr><td>INV-1045</td><td>Umbrella</td><td class="text-success">Paid</td><td>$395.00</td></tr></tbody></table></div>Theme it with --seed on any ancestor, for example style="--seed: #0d9488", and force a scheme with class="dark" or class="light" on a wrapper.
Accessibility
- Keep real table markup with
th scopeheaders and acaption(visually hidden if needed) so screen readers can navigate by row and column. - Every interactive part shows a visible focus ring with
:focus-visible, and tone colors pair with-foregroundtokens that keep text at 4.5:1 or better in light and dark mode.