data table
a named table with sortable heads, selected rows and an empty result. the app supplies the data and accepts each sort change.
bunx --bun shadcn@latest add @mk/data-tableserves constellation, quanta, trisys, orbit, artifacts.
example
sort the chapter count in either direction. check a row to select it; the selection follows its id when the order changes. a wider table scrolls inside its own box, or folds.
| pick | id | ship | |
|---|---|---|---|
| ar-021 | artifacts | 9 | |
| qt-014 | quanta | 6 | |
| tr-008 | trisys | 3 |
| pick | id | ship | |
|---|---|---|---|
| ar-021 | artifacts | 9 | |
| qt-014 | quanta | 6 | |
| tr-008 | trisys | 3 |
sort and row states
the first head starts unsorted. its chevron appears under the pointer or keyboard focus; a click chooses ascending, then descending. these board rows use the 56 px measure.
| status | |
|---|---|
| rest | queued |
| hover | half edge |
| selected | solid edge |
| 3 |
ascending
click the head to reverse the sort
| 9 |
descending
click the head to reverse the sort
| status | |
|---|---|
| rest | queued |
| hover | half edge |
| selected | solid edge |
| 3 |
ascending
click the head to reverse the sort
| 9 |
descending
click the head to reverse the sort
marks the row under the pointer, beside its cells
titles
TableTitle is a row’s name: plain text until it gets an href or the app’s router link, then a link that underlines on hover and reaches 44 px on a phone. a receding row is still live and fading, so it prints muted with no strike.
| draft | id |
|---|---|
| the reading layout | qt-014 |
| notes with no page yet | tr-008 |
| the old chapter plan | ar-021 |
| draft | id |
|---|---|
| the reading layout | qt-014 |
| notes with no page yet | tr-008 |
| the old chapter plan | ar-021 |
fold
set fold and the table reaches the panel’s edges. above 776 px of its own width it is a table of fixed columns. below that each row folds into two lines, with no sideways scroll. a TableTitle link covers its whole row, and a sortable head stays on screen as one line of sort buttons. flag lifts a fact that is still open to foreground.
detail
TableDetail holds the open state, controlled or its own. TableDetailTrigger is the row’s name as a button: its area covers the row and its chevron turns over while the detail is open. TableDetailRow lines up with the title and takes the row’s rule. it stays mounted while closed, so what you typed in it survives. the first row here starts open; open the others. a plain table takes the same rows.
| event | took |
|---|---|
| 2m | |
| 12 items, 3 of them new. nothing needed a decision. | |
| 40s | |
| 4 threads filed, 1 left for you to read. | |
| event | took |
|---|---|
| 2m | |
| 12 items, 3 of them new. nothing needed a decision. | |
| 40s | |
| 4 threads filed, 1 left for you to read. | |
sub-entries
TableSubRow hangs an entry off the row above, under its title, with a connector in the rule ink. the row keeps its rule for the last entry. lead={false} on a detail or a sub-entry drops the empty lead cell, for a table with no lead column.
results
a log prints how each entry ended as a plain word, with no badge: done, needs you, failed, skipped or paused. ink follows what is open: flag lifts a result that still waits on someone to foreground, and a closed one stays muted, so a failure a retry closed prints as quietly as done. a ship’s word is its own.
under a head
a fold with no head row opens on its own rule. straight under a section header it hangs from the header’s rule instead, as list rows do, so the two never print 16 px apart. monday’s quiet head prints no rule, so its fold keeps its own.
empty results
one real row spans every column. its status announces the changed result without removing the table or its column names.
| id | ship | status |
|---|---|---|
no waiting collectionsevery collection has moved on. change the filter to see more. | ||
| id | ship | status |
|---|---|---|
no waiting collectionsevery collection has moved on. change the filter to see more. | ||