Tables
Every table pattern for the Lustro template: basic, striped, hover, compact, bordered, sticky header, sortable, search and column filters, pagination, selectable rows, row actions, expandable rows, numeric deltas, footer totals, empty state, loading skeleton and a mobile card layout. All data is fictitious and local.
How to use it
A table compares records across shared columns. Keep real table headers, predictable row identity and readable numeric units. Use cards when the main task is reading one record at a time. The gallery below demonstrates 17 independent patterns, not one combined data-grid controller. All records, money-like amounts, dates and actions are fictitious and local.
- Define the record before styling. Stable IDs connect selection, expansion and actions. Distinguish text, numeric amount, signed delta and date fields.
- Choose density and boundaries. Basic, striped, hover, compact and bordered variants change appearance, not semantics. Hover color is not row activation.
- Make operations explicit. Sort with header buttons and aria-sort; label search/filters, pagination and selection controls. Do not infer a spreadsheet keyboard model from a table.
- Keep scope truthful. State whether totals, selection and pagination apply to all records, filtered records or one page. This gallery deliberately keeps them independent.
- Plan empty, loading and failure. No-match results need a clear reset. Loading must end on the actual result. Preserve useful input on failure; an error state is not implemented in these fixed samples.
- Check narrow screens. Most examples scroll inside their frame. The responsive variant becomes labelled cards below 640px. Keep core explanatory prose readable without horizontal scrolling.
Actual data and API
TablesGallery.vue has no props or emits. It owns 10 fixed records with { id: number, name: string, status: string, owner: string, amount: number, delta: number, date: string }. Status is Ready/Review/Example; amounts are sample numbers formatted with a dollar sign and en-US grouping, not live balances or a declared currency contract. Dates are fixed ISO-like strings. Delta is a signed sample percentage, not a computed return.
basic is the first 4 rows. sortKey starts name, sortDir 1; sortBy(k) toggles direction for the same field or starts ascending for another. sorted copies all records, sorts and displays 6. The comparator does not explicitly return 0 for equal values; add stable tie handling before relying on it for production data.
q, fStatus and fOwner combine name-substring search with exact status/owner matching; clearFilters resets all three. page starts 1, fixed size 4, with 3 pages over the unfiltered 10 rows. These controls are not wired together as one filtered/paged grid.
sel holds IDs. The header toggle currently selects all 10 source IDs, although only 6 row checkboxes are shown in that sample. allSel compares selection length to all 10; partial state sets indeterminate. This scope is important: it is not a visible-page-only select-all. A production app should state the scope and align controls with it.
list starts as a separate first 4-row copy. View/Edit set local message only; Delete removes a local row and sets message. Nothing is saved, sent or deleted externally. open holds one expanded ID or null. loading starts true and toggles manually. emptyQ starts zzz; its Clear filters button only clears that string and does not replace the fixed empty specimen with records. Footer total sums all 10 amounts; average is the arithmetic mean of all 10 deltas, not a weighted return or filtered total.
<script setup>
import TablesGallery from './.vitepress/theme/TablesGallery.vue'
</script>
<template><TablesGallery /></template>The same component is used by Lustro tables. There is no server, storage, request timer or installed data-grid API. Local state resets on remount. Add operation identity, cancellation/stale-response protection and defined selection behavior before introducing remote data.
Pattern map
| Pattern | Behavior and limits |
|---|---|
| Basic / striped / hover | Header/body structure, badges and row appearance; no row-click action. |
| Compact / bordered | Dense padding or cell boundaries; keep readable text/hit areas. |
| Sticky header | Header sticks inside a 230px scroll frame, not the whole document. |
| Sortable | Header buttons update local order and aria-sort; six results shown. |
| Search and filters | Independent combined filters with count and real no-match/reset path. |
| Pagination | Four rows per page over all ten, independent of filters. |
| Selectable | Native checkboxes; header selects all ten IDs despite six displayed rows. |
| Row actions | View/Edit feedback; Delete removes a local demo row only. |
| Expandable | One detail row at a time, toggled by named aria-expanded button. |
| Deltas | Signed percent plus color, right-aligned tabular numbers. |
| Footer totals | All-record amount sum and unweighted mean delta, not filtered totals. |
| Empty | Fixed demonstration; its clear button changes only displayed query text. |
| Loading | Manual skeleton/data switch with aria-busy, no real request. |
| Responsive | Four sample records become labelled cards below 640px. |
Source coverage
| Source | Actual implementation |
|---|---|
| Lustro UI kit, Components, Lustro guide | Small static table specimens. The 17-pattern gallery on this page is a separate local component. |
| Lustro expanded, Felix expanded, Scopecraft expanded | Styled static basic/striped/hover and other visual table variants, not a universal sorting/filter/pagination API. |
| Lumen expanded | Actual rendered gallery is in an iframe; inspect that HTML rather than assuming this gallery's behavior. |
| Felix molecule | Fixed sample transfer-history table. Package names in prose are design-source usage, not verified installed Table exports. |
| Bastion tables | Local sample table in the catalog, separate from this gallery's state. |
| Studio catalogs | Catalog search filters local rows. Extended adds its own search/sort/table variants. Those states do not share this component's API. |
| Pulsefit HTML | Styled HTML table specimens; visual similarity does not imply these 17 local controllers. |
Motion, keyboard and integration
The gallery's skeleton shimmer uses 1.4s animation, removed by reduced motion. Sorting, selection and expansion do not wait for animation. Use native button/checkbox keyboard behavior, visible focus and named controls. This is not a grid with custom arrow navigation. Keep column headers and a caption or associated heading for each table; a nearby visual heading is not always an explicit accessible-name relationship.
Test sort directions/aria-sort, combined filters and no-match recovery, page limits, selection scope/indeterminate state, local row actions, expansion, totals, loading and mobile cards. Test sticky headers in their own scroll frame. Review screen-reader table navigation after responsive CSS changes. A skeleton's visual presence and aria-busy do not alone provide a full loading announcement strategy.
For production, enforce permissions server-side, validate actions, give destructive actions an appropriate confirmation/undo route, keep stable IDs and preserve focus after deletion. Do not copy this gallery's all-ten selection scope or fixed empty state without making that policy intentional. All examples remain fictitious and local.
Live pattern gallery
Basic
Plain semantic table with status badges. Wrap every table in a scroll frame.
| Component | Status | Owner |
|---|---|---|
| Buttons | Ready | Design |
| Notifications | Review | Product |
| Graphs | Example | Motion |
| Toasts | Ready | Design |
Striped
| Component | Status | Owner |
|---|---|---|
| Buttons | Ready | Design |
| Notifications | Review | Product |
| Graphs | Example | Motion |
| Toasts | Ready | Design |
| Calendar | Review | Product |
| Messaging | Ready | Platform |
Hover rows
| Component | Status | Owner |
|---|---|---|
| Buttons | Ready | Design |
| Notifications | Review | Product |
| Graphs | Example | Motion |
| Toasts | Ready | Design |
Compact
Tighter padding for dense data.
| Component | Owner | Amount |
|---|---|---|
| Buttons | Design | $1,240 |
| Notifications | Product | $860 |
| Graphs | Motion | $2,310 |
| Toasts | Design | $430 |
| Calendar | Product | $1,980 |
| Messaging | Platform | $3,150 |
| Pricing | Growth | $720 |
Bordered
| Component | Status | Owner |
|---|---|---|
| Buttons | Ready | Design |
| Notifications | Review | Product |
| Graphs | Example | Motion |
| Toasts | Ready | Design |
Sticky header
The header stays visible while the body scrolls inside a fixed height.
| Component | Owner | Date | Amount |
|---|---|---|---|
| Buttons | Design | 2026-09-02 | $1,240 |
| Notifications | Product | 2026-09-05 | $860 |
| Graphs | Motion | 2026-09-11 | $2,310 |
| Toasts | Design | 2026-09-14 | $430 |
| Calendar | Product | 2026-09-18 | $1,980 |
| Messaging | Platform | 2026-09-21 | $3,150 |
| Pricing | Growth | 2026-09-25 | $720 |
| Dependency graph | Motion | 2026-09-28 | $1,560 |
| Shipping label | Platform | 2026-10-01 | $940 |
| Node flow | Motion | 2026-10-03 | $2,740 |
Sortable
Click a header to sort; click again to reverse.
| Buttons | Design | $1,240 |
| Calendar | Product | $1,980 |
| Dependency graph | Motion | $1,560 |
| Graphs | Motion | $2,310 |
| Messaging | Platform | $3,150 |
| Node flow | Motion | $2,740 |
Search and column filters
10 of 10 rows
| Component | Status | Owner |
|---|---|---|
| Buttons | Ready | Design |
| Notifications | Review | Product |
| Graphs | Example | Motion |
| Toasts | Ready | Design |
| Calendar | Review | Product |
| Messaging | Ready | Platform |
| Pricing | Example | Growth |
| Dependency graph | Review | Motion |
| Shipping label | Ready | Platform |
| Node flow | Example | Motion |
Pagination
| Component | Owner | Amount |
|---|---|---|
| Buttons | Design | $1,240 |
| Notifications | Product | $860 |
| Graphs | Motion | $2,310 |
| Toasts | Design | $430 |
Selectable rows
No rows selected
| Component | Owner | |
|---|---|---|
| Buttons | Design | |
| Notifications | Product | |
| Graphs | Motion | |
| Toasts | Design | |
| Calendar | Product | |
| Messaging | Platform |
Row actions
| Component | Owner | Actions |
|---|---|---|
| Buttons | Design | |
| Notifications | Product | |
| Graphs | Motion | |
| Toasts | Design |
Actions are local and fictitious.
Expandable rows
| Expand | Component | Status |
|---|---|---|
| Buttons | Ready | |
| Notifications | Review | |
| Graphs | Example | |
| Toasts | Ready |
Numeric columns with deltas
Right-align numbers, use tabular figures, and pair color with a sign so it does not rely on color alone.
| Component | Amount | Change |
|---|---|---|
| Buttons | $1,240 | ▲ +4.2% |
| Notifications | $860 | ▼ -1.8% |
| Graphs | $2,310 | ▲ +12.5% |
| Toasts | $430 | ▲ +0.6% |
| Calendar | $1,980 | ▼ -6.4% |
| Messaging | $3,150 | ▲ +8.9% |
Footer totals
| Component | Amount | Change |
|---|---|---|
| Buttons | $1,240 | +4.2% |
| Notifications | $860 | -1.8% |
| Graphs | $2,310 | +12.5% |
| Toasts | $430 | +0.6% |
| Calendar | $1,980 | -6.4% |
| Messaging | $3,150 | +8.9% |
| Pricing | $720 | -2.3% |
| Dependency graph | $1,560 | +3.1% |
| Shipping label | $940 | +1.4% |
| Node flow | $2,740 | -0.9% |
| Total / average | $15,930 | +1.9% |
Empty state
No components match “zzz”. Try a different search or clear your filters.
Loading skeleton
| Component | Status | Owner |
|---|---|---|
Responsive card layout
Under 640 px each row becomes a labeled card. Resize the window to see it.
| Component | Status | Owner | Amount |
|---|---|---|---|
| Buttons | Ready | Design | $1,240 |
| Notifications | Review | Product | $860 |
| Graphs | Example | Motion | $2,310 |
| Toasts | Ready | Design | $430 |
Production checklist
Use real th scope, a caption or heading for every table, aria-sort on sortable headers, and visible focus. Never rely on color alone for deltas. Data above is fictitious and local.