Tables & Lists
Four ways to show a list of records - from a classic table to rows on a grid. This page explains which one to pick and what each of them requires. Ready-made layouts are in the examples.
1. What to choose
The choice comes down to one question: are you comparing records column by column, or just browsing them.
| Component | When | What it's built on |
|---|---|---|
.table |
Data comparable by columns: reports, statements, invoices. |
<table> - keeps table semantics.
|
.data-row |
A list of records with actions: clients, projects, orders. | CSS Grid |
.data-row-compact |
A dense list with an icon and two lines of text - notifications, files, history. | Flexbox |
.list-group |
A simple clickable list of items: settings menu, picking from a list. | Flexbox |
Why it isn't a matter of taste
<table> carries meaning: a screen reader
announces "column Status, row 3", and the user can
navigate cell by cell. A record list built from
<div>s has none of that. The reverse is also true: a table
used for visual layout misleads the screen reader. Choose
based on the data, not the looks.
2. Tables
A table always sits inside .table-wrapper - that's what gives it
horizontal scrolling when there are more columns than space. Without
it, a wide table pushes the whole page out.
<div class="table-wrapper">
<table class="table table-hover table-cards">
<thead class="thead-light">
<tr><th>Client</th><th>Status</th></tr>
</thead>
<tbody>
<tr>
<!-- data-label is REQUIRED by .table-cards -->
<td data-label="Client">Molique</td>
<td data-label="Status"><span class="badge badge-success">Active</span></td>
</tr>
</tbody>
</table>
</div>
| Client | Project | Status |
|---|---|---|
| Molique | Online store | Active |
| Briko | Client panel | Pending |
| Class | Group | What it does |
|---|---|---|
.table-wrapper |
Structure | A container with horizontal scrolling. Always wrap your table in it. |
.table |
Structure | Base style: spacing, lines, alignment. |
.table-sm |
Size | Compact - more rows on screen. |
.table-lg |
Size | Loose - fewer rows, more breathing room. |
.table-striped |
Appearance | Alternating row background. |
.table-hover |
Appearance | Highlights the row under the cursor. |
.table-borderless |
Appearance | No lines - a calmer look. |
.thead-light |
Header | Muted background (the default choice). |
.thead-dark |
Header | Dark header, light text. |
.thead-primary |
Header | Header in the brand color. |
.thead-sm |
Header | Shorter header. |
.thead-lg |
Header | Taller header. |
.table-cards |
Mobile |
On a phone every row becomes a card.
Requires data-label on every
<td> - see pitfall #1.
|
.table-cards-always |
Mobile | Same thing, but at every width. For narrow dashboard columns where the table never has enough room. |
Cell spacing variables
--table-padding-x, --table-padding-y,
--table-font-size and
--table-header-font-size tune the size variants.
You'll rarely override them directly - that's what
.table-sm and .table-lg are for, doing it
consistently.
Live search
The data-search-target attribute on any text field
filters the rows of the given table as you type - no reload, no
JavaScript of your own. A row can also carry
data-tags: the words someone searches for when they
know their problem rather than the class name.
<input type="text" class="input" placeholder="Search…"
data-search-target="#clientsBody"
data-search-status="#counter"
data-search-hotkey="/">
<span id="counter"></span>
<table class="table">
<tbody id="clientsBody">
<tr><td colspan="2" class="cheat-sheet-category">Active</td></tr>
<tr data-tags="invoic payment"><td>Molique</td><td>…</td></tr>
</tbody>
</table>
| Attribute | What it does |
|---|---|
data-search-target | Selector of the element holding the rows (usually a <tbody>). Required - nothing initialises without it. |
data-tags | On a <tr> or on an element matched by data-search-item. Extra searchable words, invisible on screen. |
data-search-item | Selector of the elements to filter instead of rows, e.g. .card in a list of cards. Defaults to tr. The empty state then appears right after the container. |
data-search-status | Selector of the element that receives the result count ("12 of 181"). |
data-search-empty | Custom empty-state text. The default follows the document lang (PL/EN/DE). |
data-search-hotkey | Key that focuses the field (e.g. /). Optional, and deliberately not on by default. |
Matching is not a plain substring test. Polish
and German inflect on the suffix, so the tag
wyśrodkowanie is not a substring of what a person
actually types, wyśrodkować. Tags are therefore
stored as stems (wysrodk), and a
term matches when the stem is a prefix of it or the other way
round. Diacritics are stripped on both sides, so
wysrodkowac from a keyboard without Polish
characters finds the same rows. The visible row text is still
matched as an ordinary substring.
A section header is a <tr> that contains a
.cheat-sheet-category cell - it is hidden once
nothing below it is left. Esc clears the field, a
?q= parameter in the URL fills it on load (so a
result can be linked), and
MoliqueTableSearch.refresh() re-indexes the table
after rows are added from JS. Visibility is toggled with the
hidden attribute, not an inline style.
3. Data rows
When you're not comparing records, just browsing them - a table is too rigid. A row on a grid wraps itself on a narrow screen, with no need to rewrite the layout.
Full variant
Columns are just plain children of .data-row - however many
you insert, that's how many there will be. The actions block gets pushed to the right edge.
<div class="data-row">
<div class="fw-bold">Project name</div>
<div class="text-muted">Parameters</div>
<div><span class="status-dot status-pending">Pending</span></div>
<div class="data-row-actions">
<button class="btn-action">Edit</button>
</div>
</div>
Compact variant
It has a fixed structure: icon, two lines of content, actions. That way a list of notifications or files looks the same everywhere. Want users to drag and reorder this list? See the Sortable List.
<div class="data-row-compact">
<div class="row-icon"><span class="icon-square"><svg class="icon" aria-hidden="true"><use href="img/icons-sprite.svg#ph-file-text"></use></svg></span></div>
<div class="row-content">
<div class="row-title">Framework agreement.pdf</div>
<div class="row-details">2.4 MB · yesterday</div>
</div>
<div class="row-actions">
<button class="btn-action">Download</button>
</div>
</div>
| Class | Variant | What it does |
|---|---|---|
.data-row |
Full | A row on a grid; columns are its children. |
.data-row-actions |
Full | Button block pushed to the right. |
.data-row-compact |
Compact | A row with a fixed structure: icon, content, actions. |
.row-icon |
Compact | Slot for an icon on the left. |
.icon-square |
Compact | Square background behind the icon. |
.row-content |
Compact | Text column; fills the remaining space. |
.row-title |
Compact | First line - the record's name. |
.row-details |
Compact | Second line - metadata, muted. |
.row-actions |
Compact | Buttons on the right. |
4. Lists and counters
Item list
A vertical list of clickable elements - settings menu, picking
from a list. The current item is marked with .is-active.
<div class="list-group">
<a href="#" class="list-group-item is-active">Account settings</a>
<a href="#" class="list-group-item">Notifications</a>
</div>
Icon lists
Bullets replaced with an icon - typically a feature list in pricing. The icon and its color are chosen with separate classes, so "green checkmark" and "red cross" are two independent decisions.
<ul class="list-icons list-icons-check list-icons-success">
<li>Unlimited accounts</li>
<li>24/7 support</li>
</ul>
<ul class="list-unstyled">…</ul> <!-- just a list with no bullets -->
Counters
A large number with a caption - "512 deployments". You set the target
value as the content of .counter-value; the
js/modules/molique-counters.js module counts up to it once
the element scrolls into view. Without JavaScript the number is
still visible, just without the animation.
<div class="counter">
<div class="counter-value">512</div>
<div class="counter-title">deployments</div>
</div>
| Class | What it does |
|---|---|
.list-group |
Wrapper for the item list. |
.list-group-item |
A single item. .is-active marks the current one.
|
.list-unstyled |
A list with no bullets and no indent. |
.list-icons |
Bullets replaced with an icon. |
.list-icons-check |
Icon: checkmark. |
.list-icons-arrow |
Icon: arrow. |
.list-icons-cross |
Icon: cross. |
.list-icons-success |
Icon color: green. |
.list-icons-danger |
Icon color: red. |
.list-icons-dark |
Icon color: contrasting with the background. Without a color class the icon is in the brand color. |
.counter |
Wrapper for the counter. |
.counter-value |
The number itself. Its presence triggers the count-up module. |
.counter-title |
Caption below the number. |
5. Pitfalls
1
.table-cards without data-label
On desktop everything looks fine, so the bug only shows up on a phone: the rows turn into cards, but without column names - you're left with bare values, one under another. "Active $12,400 2026-03-01" and there's no telling what is what.
CSS takes the labels exclusively from the attribute - it can't
read them from <th>. When generating a table in a
loop, fill data-label with the same variable as the
header.
2
A table without .table-wrapper
A table doesn't wrap its content, so a wide one will push its parent out and trigger a horizontal scrollbar for the entire page. The symptom can be misleading: "the page shifts on a phone", while the culprit is a table somewhere else entirely.
3 An actions menu clipped inside a table
.table-wrapper has its own scrolling, so a
dropdown menu next to a row will get clipped inside it. This isn't
a bug in the wrapper - that's just how overflow works.
Use the Popover-API dropdown variant instead: the panel lands in the top
layer, outside the reach of clipping. Details in
Navigation.
4 A table used for page layout
If the "columns" aren't features of the same kind,
<table> lies to the screen reader -
it announces rows and columns where there are none. Use a
grid for layout instead: .grid-cols-* or
.data-row.