Resource totals — Table block

Pro

table-resource-totals · for app pages

Resource totals

Records whose amounts matter together: a footer with the selection count and the list’s own totals

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-resource-totals

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import TableResourceTotals from '@/components/trame/blocks/table/table-resource-totals.vue'

const props = {
title: "Invoices",
subtitle: "October 2026",
count: 30,
columns: [
{
key: "number",
label: "Invoice",
type: "id",
sortable: true
},
{
key: "customer",
label: "Customer",
type: "text",
priority: 2
}
],
rows: [
{
id: 1,
number: "F-2026-0412",
customer: "Summit Workshop",
due: "2026-10-20",
status: "open",
total: 184000
},
{
id: 2,
number: "F-2026-0411",
customer: "Maison Berthier",
due: "2026-10-12",
status: "late",
total: 92650,
tones: {
due: "danger"
}
}
],
statuses: [
{
value: "open",
label: "Sent",
tone: "info"
},
{
value: "paid",
label: "Paid",
tone: "success"
}
],
filters: [
{
label: "All",
count: 30,
active: true,
action: "invoices.filter",
record: {
id: "all"
}
},
{
label: "Overdue",
count: 4,
action: "invoices.filter",
record: {
id: "late"
}
}
],
search: {
placeholder: "Search for an invoice or a customer",
action: "invoices.list"
},
sort: {
key: "due",
dir: "asc",
action: "invoices.list"
},
page: {
number: 1,
size: 5,
action: "invoices.list"
},
bulkActions: [
{
label: "Send a reminder",
action: "invoices.remind"
},
{
label: "Export",
action: "invoices.export"
}
],
create: {
label: "New invoice",
action: "invoices.new"
},
open: "invoice.open",
totals: [
{
key: "total",
value: 3820450
}
],
empty: {
title: "No orders yet",
text: "Orders placed in the shop will show up here.",
action: {
label: "Create an order",
action: "orders.new"
}
},
noMatch: {
title: "No orders match",
text: "Try another number or name, or remove a filter.",
clear: {
label: "Clear search and filters",
action: "orders.list"
}
},
options: {
currency: "USD",
totalsLabel: "Total across the 30 invoices"
}
}
</script>

<template>
<TableResourceTotals 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
totals*Total[]the column totals the server computed
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
Total totals[] · 2 props
PropTypeDescription
key*stringDesignthe column it sums
value*numberDatathe server’s total, in the column’s unit (cents for money)
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 · 3 props
PropTypeDescription
totalsLabelstringWordswhat the totals row calls itself ("Total over the whole list")
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

  • Record rows list: comparable records, each with a picture or initials, two lines and a badge: members, channels.
  • Resource list cards: records read by their picture or a few fields (products, team members): a grid of cards with the same search, filters, sort and selection.
  • Resource list compact: long lists worked through quickly: dense rows, a density switch, a sticky header and identity column.
  • Resource list: records a team searches, sorts and acts on, one comfortable row each: orders, invoices, customers.
  • Spreadsheet grid: Edit a dense table with a frozen first column and row selection, then save the edits in one go.
  • Spreadsheet summary bar: Keep the selection count and numeric sum prominent above the editable grid, saved in one go.
  • Stage rows track cards: fewer records each needing a next step: one card per record with a status sentence, the labelled track full width and the action beside it, filters in a rail.
  • Stage rows track: many records followed at a glance (shipments, sales orders): a table whose progress column is a row of joined dots, an exception named in words.

All 24 table blocks