Column comparison — Table block

Pro

table-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-comparison

Usage

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.

PropTypeDescription
title*stringWordsthe list’s heading ("Orders")
subtitlestringWordsone line under the title
countnumberDatathe 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
statusesStatuse[]the words and tone of each status value, as the app defines them
filtersFilter[]filter chips; each is a link the host answers (the query lives in the address)
viewsView[]saved views, a segmented switch of links
searchSearchthe search field
sortSortthe sort in effect and the page action
pagePagethe page shown and the page action
bulkActionsBulkAction[]what the selection can do; without any, rows are not selectable
createCreatethe header’s primary action
openstringActionthe page a row’s first cell leads to
columnGroups*ColumnGroup[]grouped variant: the upper header row, from the second column on
emptyEmptywhat an empty list says
noMatchNoMatchwhat a search or filter that matches nothing says
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Column columns[] · 5 props
PropTypeDescription
key*stringDesignthe row key to read
label*stringWordsthe 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
sortablebooleantrue: the column’s heading sorts the list
prioritynumber1: always visible, 2: from 640 px, 3: from 1024 px; below, it folds under the first cell
Statuse statuses[] · 3 props
PropTypeDescription
value*stringDesignthe value a row stores
label*stringWordsthe status in words, e.g. "Paid"
tone'neutral' | 'info' | 'success' | 'warning' | 'danger'the status colour
Filter filters[] · 5 props
PropTypeDescription
label*stringWordsthe link’s words, e.g. "Unpaid"
countnumberDatahow many records it holds, as the host counted them
activebooleantrue: this is the one shown now
action*stringActionthe page action that shows it
recordRecord<string, unknown>Datawhat the action needs (the filter’s value)
View views[] · 4 props
PropTypeDescription
label*stringWordsthe link’s words, e.g. "Unpaid"
activebooleantrue: this is the one shown now
action*stringActionthe page action that shows it
recordRecord<string, unknown>Datawhat the action needs (the filter’s value)
Search search · 3 props
PropTypeDescription
placeholder*stringWordswhat the search field says ("Search for an order")
valuestringWordsthe current query, as the address carries it
action*stringActionthe page the form sends the query to (?q=)
Sort sort · 3 props
PropTypeDescription
keystringDesignthe column sorted now
dir'asc' | 'desc'the sort direction: ascending or descending
action*stringActionthe page action; the record carries sort and dir
Page page · 3 props
PropTypeDescription
number*numberthe page shown, from 1
size*numberhow many rows a page holds
action*stringActionthe page action; the record carries page
BulkAction bulkActions[] · 4 props
PropTypeDescription
label*stringWordsthe action’s words, e.g. "Archive"
action*stringActionthe page action: through a host that runs actions it receives `{ ids }`; else a link whose record carries ids (comma separated)
destructivebooleantrue: it deletes or cannot be undone, and looks it
confirmstringWordsthe question asked before it runs, saying it cannot be undone
Create create · 2 props
PropTypeDescription
label*stringWordsthe words on the button or link
action*stringActiona named action of the page
ColumnGroup columnGroups[] · 2 props
PropTypeDescription
label*stringWordsthe column group’s name, as shown
span*numberhow many columns the group covers
Empty empty · 3 props
PropTypeDescription
title*stringWordswhat an empty collection says ("No orders yet")
textstringWordsthe empty state’s text
actionActionthe empty state’s call to action: its words and the page action
Action empty.action · 2 props
PropTypeDescription
label*stringWordsthe words on the button or link
action*stringActiona named action of the page
NoMatch noMatch · 3 props
PropTypeDescription
title*stringWordswhat a search or filter that matches nothing says
textstringWordsthe no-match state’s text
clearClearthe clear action: its words and the page action it runs
Clear noMatch.clear · 2 props
PropTypeDescription
label*stringWordsthe words on the button or link
action*stringActiona named action of the page
Options options · 2 props
PropTypeDescription
currencystringDesignISO 4217 for money cells, EUR by default
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa 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).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
moneyformats a price, given in cents
asseta picture’s address as your app serves it
Linkyour router’s link component
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour 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:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo 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 rows from 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.

All 24 table blocks