Column comparison — Table block
Protable-column-comparison · for app pages
Column comparison
The same measures in two contexts side by side: an upper header row groups the columns, numbers align right
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/table-column-comparisonUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import TableColumnComparison from '@/components/trame/blocks/table/table-column-comparison.vue'
const props = {
title: "Sales by product",
subtitle: "September 2026",
count: 5,
columns: [
{
key: "name",
label: "Product",
type: "text",
sortable: true
},
{
key: "sRevenue",
label: "Revenue",
type: "money",
priority: 1
}
],
rows: [
{
id: 1,
name: "Windbreaker jacket",
sRevenue: 1284000,
sOrders: 312,
sReturns: 1.2,
mRevenue: 842000,
mOrders: 154,
mReturns: 4.8
},
{
id: 2,
name: "25 L backpack",
sRevenue: 964500,
sOrders: 241,
sReturns: 0.9,
mRevenue: 410300,
mOrders: 98,
mReturns: 1.1
}
],
sort: {
key: "date",
dir: "desc",
action: "orders.list"
},
columnGroups: [
{
label: "Online store",
span: 3
},
{
label: "Marketplace",
span: 3
}
],
empty: {
title: "No orders yet",
text: "Orders placed in the store will appear here.",
action: {
label: "Create an order",
action: "orders.new"
}
},
noMatch: {
title: "No matching orders",
text: "Try another number or name, or remove a filter.",
clear: {
label: "Clear search and filters",
action: "orders.list"
}
},
options: {
currency: "USD"
}
}
</script>
<template>
<TableColumnComparison v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe list’s heading ("Orders") |
| subtitle | string | Wordsone line under the title |
| count | number | Datathe total of records, when the rows are only a page of them |
| columns* | Column[] | the columns, the first being the record’s identity |
| rows* | Record<string, unknown>[] | Datathe records; each carries an id and the keys the columns name; money in cents; an `image` column holds a picture address; `tones` maps a key to a tone |
| statuses | Statuse[] | the words and tone of each status value, as the app defines them |
| filters | Filter[] | filter chips; each is a link the host answers (the query lives in the address) |
| views | View[] | saved views, a segmented switch of links |
| search | Search | the search field |
| sort | Sort | the sort in effect and the page action |
| page | Page | the page shown and the page action |
| bulkActions | BulkAction[] | what the selection can do; without any, rows are not selectable |
| create | Create | the header’s primary action |
| open | string | Actionthe page a row’s first cell leads to |
| columnGroups* | ColumnGroup[] | grouped variant: the upper header row, from the second column on |
| empty | Empty | what an empty list says |
| noMatch | NoMatch | what a search or filter that matches nothing says |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Column columns[] · 5 props
| Prop | Type | Description |
|---|---|---|
| key* | string | Designthe row key to read |
| label* | string | Wordsthe column’s name |
| type | 'text' | 'id' | 'money' | 'number' | 'date' | 'status' | 'person' | 'image' | 'boolean' | how a cell reads; without it, from the first values: number, date (ISO), boolean, status (a value of statuses), person ({ name }), else text; money only when said |
| sortable | boolean | true: the column’s heading sorts the list |
| priority | number | 1: always visible, 2: from 640 px, 3: from 1024 px; below, it folds under the first cell |
Statuse statuses[] · 3 props
| Prop | Type | Description |
|---|---|---|
| value* | string | Designthe value a row stores |
| label* | string | Wordsthe status in words, e.g. "Paid" |
| tone | 'neutral' | 'info' | 'success' | 'warning' | 'danger' | the status colour |
Filter filters[] · 5 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe link’s words, e.g. "Unpaid" |
| count | number | Datahow many records it holds, as the host counted them |
| active | boolean | true: this is the one shown now |
| action* | string | Actionthe page action that shows it |
| record | Record<string, unknown> | Datawhat the action needs (the filter’s value) |
View views[] · 4 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe link’s words, e.g. "Unpaid" |
| active | boolean | true: this is the one shown now |
| action* | string | Actionthe page action that shows it |
| record | Record<string, unknown> | Datawhat the action needs (the filter’s value) |
Search search · 3 props
| Prop | Type | Description |
|---|---|---|
| placeholder* | string | Wordswhat the search field says ("Search for an order") |
| value | string | Wordsthe current query, as the address carries it |
| action* | string | Actionthe page the form sends the query to (?q=) |
Sort sort · 3 props
| Prop | Type | Description |
|---|---|---|
| key | string | Designthe column sorted now |
| dir | 'asc' | 'desc' | the sort direction: ascending or descending |
| action* | string | Actionthe page action; the record carries sort and dir |
Page page · 3 props
| Prop | Type | Description |
|---|---|---|
| number* | number | the page shown, from 1 |
| size* | number | how many rows a page holds |
| action* | string | Actionthe page action; the record carries page |
BulkAction bulkActions[] · 4 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe action’s words, e.g. "Archive" |
| action* | string | Actionthe page action: through a host that runs actions it receives `{ ids }`; else a link whose record carries ids (comma separated) |
| destructive | boolean | true: it deletes or cannot be undone, and looks it |
| confirm | string | Wordsthe question asked before it runs, saying it cannot be undone |
Create create · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe words on the button or link |
| action* | string | Actiona named action of the page |
ColumnGroup columnGroups[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe column group’s name, as shown |
| span* | number | how many columns the group covers |
Empty empty · 3 props
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordswhat an empty collection says ("No orders yet") |
| text | string | Wordsthe empty state’s text |
| action | Action | the empty state’s call to action: its words and the page action |
Action empty.action · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe words on the button or link |
| action* | string | Actiona named action of the page |
NoMatch noMatch · 3 props
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordswhat a search or filter that matches nothing says |
| text | string | Wordsthe no-match state’s text |
| clear | Clear | the clear action: its words and the page action it runs |
Clear noMatch.clear · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe words on the button or link |
| action* | string | Actiona named action of the page |
Options options · 2 props
| Prop | Type | Description |
|---|---|---|
| currency | string | DesignISO 4217 for money cells, EUR by default |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| money | formats a price, given in cents |
| asset | a picture’s address as your app serves it |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
| rl.done | “{label}”: {count} done | « {label} » : {count} traité(s) |
| rl.partly | “{label}”: {done} done, {failed} failed and still selected | « {label} » : {done} traité(s), {failed} en échec, restés sélectionnés |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
filters[],views[],search,sort,page,bulkActions[],create,open,empty.action,noMatch.clear - Reads
rowsfrom your app
A table section, for app pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.
Built with
The components this block is made of; each one installs on its own too.
More table blocks
- Action rows monospace meta: records identified by a token (a query, a key, a path) with a visibility badge.
- Audit log timeline: A dated ledger with inline field changes for reconstructing the merchant’s own sequence of events.
- Audit log: An exhaustive filterable register for reviewing the merchant’s own recorded actions and changes.
- Change review split: An event index beside one expanded before-and-after comparison of the merchant’s own recorded values.
- Filtered rows tabbed: records to sort through: filter chips with counts, an overdue date said in words as well as colour.
- Grouped sheet grid: Separate editable rows by an existing field value to work through related records, then save the edits in one go.
- Nested rows cards with lines: each parent as a card (identity, status and figures on its head) with its lines listed under it, all open: fewer parents read one by one, lines with their pictures.
- Nested rows inline expand: a table of parent records whose row opens its lines as an indented sub-table underneath, the first one open: orders and their lines, customers and their invoices, scanned by column.