Views for every team

One table of records, many ways to look at it. Product reads the roadmap grouped by quarter, engineering works off a status board, the leads check a timeline, and anyone in the company files a request through a form. Each of those is a saved view: a name, a type, and the filter, sorts, groups, hidden fields, row height and colors it had when someone last left it.

The Features table feeds six saved views: Roadmap by quarter (a grid grouped by Quarter, sorted by Impact, Lead hidden, row height 56, colored by Status), Now (a grid filtered to active work), Status board (a Kanban stacked by Status), Timeline (bars from Start to Target), Effort by team (a bar chart) and Request a feature (a form). onViewsChange hands the whole list to the app, which stores it and loads it back into bind:views.

Open the live example: Product roadmap (Base)

SvGrid Base is part of the Suite edition of @svgrid/enterprise. Without a key it runs with a watermark.

This page builds the Features table of that roadmap one view at a time. Each step adds to the views list from the step before and works on its own.

1. The table

<script lang="ts">
  import { SvBase, enableBase, setFieldUsers, type FieldView } from '@svgrid/enterprise/base'

  enableBase()
  setFieldUsers([
    { id: 'u1', name: 'Ana Ruiz' },
    { id: 'u2', name: 'Ben Okafor' },
    { id: 'u3', name: 'Cleo Park' },
  ])

  type Feature = {
    id: number; feature: string; quarter: string; status: string; teams: string[]
    lead: string; impact: number; effort: number; start: string; target: string; votes: number
  }

  const QUARTERS = [
    { value: 'Q4 2026', color: '#2d7ff9' },
    { value: 'Q1 2027', color: '#18bfff' },
    { value: 'Later', color: '#94a3b8' },
  ]
  const STATUS = [
    { value: 'Planned', color: '#94a3b8' },
    { value: 'In progress', color: '#2d7ff9' },
    { value: 'In beta', color: '#8b46ff' },
    { value: 'Shipped', color: '#20c933' },
    { value: 'Blocked', color: '#f82b60' },
  ]
  const TEAMS = [
    { value: 'Web', color: '#2d7ff9' },
    { value: 'Mobile', color: '#ff6f2c' },
    { value: 'Platform', color: '#8b46ff' },
  ]

  let rows = $state.raw<Feature[]>([
    { id: 1, feature: 'Single sign-on with SAML', quarter: 'Q4 2026', status: 'In progress', teams: ['Platform'], lead: 'u2', impact: 5, effort: 12, start: '2026-10-05', target: '2026-11-13', votes: 182 },
    { id: 2, feature: 'Offline mode for the mobile app', quarter: 'Q4 2026', status: 'Blocked', teams: ['Mobile'], lead: 'u3', impact: 4, effort: 13, start: '2026-10-12', target: '2026-12-04', votes: 96 },
    { id: 3, feature: 'Dark mode', quarter: 'Q4 2026', status: 'Shipped', teams: ['Web'], lead: 'u1', impact: 2, effort: 4, start: '2026-10-01', target: '2026-10-16', votes: 154 },
    { id: 4, feature: 'Audit log export', quarter: 'Q1 2027', status: 'Planned', teams: ['Platform', 'Web'], lead: 'u1', impact: 3, effort: 5, start: '2027-01-11', target: '2027-01-29', votes: 41 },
  ])

  const columns = [
    { field: 'feature', header: 'Feature', width: 260, fieldType: 'text' },
    { field: 'quarter', header: 'Quarter', fieldType: 'singleSelect', fieldProps: { options: QUARTERS } },
    { field: 'status', header: 'Status', fieldType: 'singleSelect', fieldProps: { options: STATUS } },
    { field: 'teams', header: 'Teams', fieldType: 'multiSelect', fieldProps: { options: TEAMS } },
    { field: 'lead', header: 'Lead', fieldType: 'user' },
    { field: 'impact', header: 'Impact', fieldType: 'rating', fieldProps: { max: 5 } },
    { field: 'effort', header: 'Effort (days)', fieldType: 'number', fieldProps: { format: 'integer', summary: 'sum' } },
    { field: 'start', header: 'Start', fieldType: 'date', fieldProps: { dateFormat: 'friendly' } },
    { field: 'target', header: 'Target', fieldType: 'date', fieldProps: { dateFormat: 'friendly' } },
    { field: 'votes', header: 'Votes', fieldType: 'number', fieldProps: { format: 'integer', summary: 'sum' } },
  ]

  let views = $state<FieldView[]>([{ id: 'all', name: 'All features', type: 'grid' }])
</script>

<SvBase data={rows} {columns} bind:views primaryField="feature"
  editable sortable showRowNumbers expandRows summary containerHeight={640}
  rowAdder={{ label: 'Add feature', defaults: () => ({ id: Date.now(), status: 'Planned', quarter: 'Later', teams: [] }) }} />

The view bar over the grid has "All features" on the left, then Hide fields, Filter, Group, Sort, Color and a row height button, and "4 records" with a search button on the right. The footer row shows "Sum 34" under Effort and "Sum 473" under Votes, because those fields set fieldProps.summary.

Every view key that names a field (stackBy, dateField, a filter condition's column, a chart's x) takes the column id. A column without an id uses its field, so in this table the two are the same.

2. A roadmap grouped by quarter

A view can start with settings. state is the grid's own state, the same object api.getState() returns; color says how rows are colored.

const roadmap: FieldView = {
  id: 'roadmap',
  name: 'Roadmap by quarter',
  type: 'grid',
  color: { mode: 'field', field: 'status' },
  rowHeight: 56,
  state: {
    grouping: ['quarter'],
    sorting: [{ id: 'quarter', desc: false }, { id: 'impact', desc: true }],
    hiddenColumns: ['lead'],
  },
}

Groups and sorts share the grid's sorting list: a grouped field's direction is an entry ahead of the sorts. The view bar writes them that way, so write them that way too. Here the bar reads "1 hidden field", "Grouped by 1 field" and "Sorted by 1 field": the quarter entry belongs to the group, not to Sort.

Each group header shows "Quarter" over the option's pill, the number of records, the summaries the fields picked for that group ("Effort (days) 29", "Votes 432"), and "+" to add a feature that already has that quarter. Groups come in the select's option order, not alphabetically. Group rows are at least 52px tall so the field's name fits over the value; with rowHeight: 56 they match the records. Each row has a status color stripe on its row header. 56 is the row height menu's "Medium": from 48px, text and select pills wrap.

Cells can be colored too, a spreadsheet's conditional formatting kept with the view. cellColors is a list of rules; each tints the cell of the field its condition tests while the record matches, and for one field the first match wins. The view bar's Color has them under Cells:

const atRisk: FieldView = {
  id: 'at-risk',
  name: 'At risk',
  type: 'grid',
  cellColors: [
    { color: '#f82b60', condition: { column: 'target', kind: 'date', op: 'isBefore', value: { mode: 'today' } } },
    { color: '#fcb400', condition: { column: 'effort', kind: 'number', op: 'gt', value: 20 } },
  ],
}

The tint is the rule's color at 30% over the cell, so text stays readable in a light or dark theme. Under Rows, Mark records by hand adds a "Highlight" single select (Yellow, Red, Green, Blue) and colors the rows by it: a color picked by hand that is still a value forms, filters and the API read. In a base's grid, Ctrl+B, Ctrl+I, Ctrl+U and Ctrl+1 change nothing and say once where colors come from, with Open Color.

3. A view that starts filtered

The filter is the grid's advanced filter with its own kind, fieldFilter. Put it in state.advancedFilter:

import { describeFieldFilter, type FieldFilter } from '@svgrid/enterprise/base'

const activeWork: FieldFilter = {
  kind: 'fieldFilter',
  conjunction: 'and',
  conditions: [
    { column: 'status', kind: 'select', op: 'isAnyOf', value: ['In progress', 'In beta', 'Blocked'] },
    {
      conjunction: 'or',
      conditions: [
        { column: 'target', kind: 'date', op: 'isWithin', value: { span: 'nextDays', days: 30 } },
        { column: 'impact', kind: 'number', op: 'gte', value: 4 },
      ],
    },
  ],
}

const now: FieldView = {
  id: 'now',
  name: 'Now',
  type: 'grid',
  state: { sorting: [{ id: 'target', desc: false }], advancedFilter: activeWork },
}

const header = (id: string) => columns.find((c) => c.field === id)?.header ?? id
describeFieldFilter(activeWork, header)
// "Status is any of In progress, In beta, Blocked and (Target is within the next 30 days or Impact ≥ 4)"

The Filter button reads "Filtered by 3 fields" (one field reads "Filtered by Status") and the record count drops to what the filter keeps. describeFieldFilter writes a filter in the words the panel uses, for a page subtitle or an audit line. It returns "every record" for a filter with no complete conditions.

A condition is a field, an operator and a value; a group is one level deep. Filters in code below lists the operators per kind.

One view can serve every lead. ME (the string '@me') in a person condition stands for whoever setCurrentUser names when the filter runs; the Filter panel lists it as "Me", first among the people.

import { ME, setCurrentUser } from '@svgrid/enterprise/base'

setCurrentUser({ id: 'u2', name: 'Ben Okafor' })

const mine: FieldView = {
  id: 'mine',
  name: 'My features',
  type: 'grid',
  state: {
    advancedFilter: {
      kind: 'fieldFilter',
      conjunction: 'and',
      conditions: [{ column: 'lead', kind: 'select', op: 'is', value: ME }],
    },
  },
}

Ben sees "Single sign-on with SAML"; Ana, signed in, sees her two. With nobody signed in the condition matches no one. describeFieldFilter writes it as "Lead is me".

4. A status board

const board: FieldView = { id: 'board', name: 'Status board', type: 'kanban', stackBy: 'status' }

The roadmap's Status board: Planned, In progress, In beta and Shipped lanes of feature cards showing Quarter, Teams and Lead, with the right-click menu open on

stackBy takes a single select or a user field that holds one person. You get one lane per option, in option order and color, plus "Uncategorized", which shows only while a record has no status. Stack by lead instead and the lanes are the people from setFieldUsers.

Sort the view by a number field and a card dropped elsewhere in its lane takes a number between its neighbours', so the order is the table's and lasts.

Drop a card in another lane and the status changes through the grid's edit path, so undo, validation and onCellValueChange all see it. "+ Add a card" adds a record already in that lane, named by the primary field.

A card shows the record's name, then the next three fields the view shows, in column order (the stacked field left out), each drawn as its cell draws it. Hide a field in Hide fields and it leaves the cards; drag it up there to put it on them. Cards are read, not edited: a rating shows its stars but does not take a click. Double-click a card or press F2 to open the record. Right-click it for its menu: Expand record, Comment, and, when the base is editable, Move to (a submenu of the lanes), Duplicate record and Delete record, which asks "Delete record?" first. A card with comments shows their count; click it to open the record at its comment box.

Customize board

"Customize board" in the view bar sets what the board shows beyond its lanes. Each change shows at once and is kept in the view:

const board: FieldView = {
  id: 'board', name: 'Status board', type: 'kanban', stackBy: 'status',
  swimlaneBy: 'team',                // rows: one band per team, in option order
  cardFields: ['quarter', 'lead'],   // up to four, in place of the next three shown
  dueField: 'target',                // a date badge, red once the day has passed
  fadeField: 'updated',              // cards fade a little more each week since it
  blockedField: 'blocked',           // a checkbox: a red corner and a Blocked badge
  quickFilters: ['teams'],           // select fields as chips above the board
  wipLimits: { 'In progress': 4 },   // the lane's count turns red past four
}

swimlaneBy takes a single select or a one-person field other than stackBy. The bands follow its options (or the people of setFieldUsers), each with the full set of lanes, and a band folds from its header; "Uncategorized" shows only while a record has no value. Drop a card in another band and that field changes too, in the same undo step as the lane.

fadeField reads a date, a Created time or a Last modified time. A Last modified time fades the cards nobody has changed, as Trello's card aging does: a little after a week, more after two and three, most after four, and a card shows at full strength under the pointer. A blocked card still moves. A wipLimits key is a lane's value ('' for Uncategorized); the lane shows 5/4 in red past it. A lane folds to a slim strip when its header is clicked.

A board that reads its table a page at a time (a data source) keeps the lanes the server counts, so it has no rows or quick filters. Deleting a field the cards show says so first ("shows it on its cards"). A field id that is no longer in the table is left out.

5. A Gantt chart, and a timeline in lanes

const plan: FieldView = {
  id: 'gantt',
  name: 'Gantt',
  type: 'gantt',
  dateField: 'start',
  endField: 'target',
  color: { mode: 'field', field: 'status' },
}

Each feature is a bar from its start to its target date, beside a table of names and dates. Drag a bar to move both dates; drag its edge to change the target. One drag is one Ctrl+Z. type: 'calendar' with the same fields shows the features on a month instead: a date field without a time shows as all-day events. The end of a bar or an event is exclusive, so the record keeps the last day: a feature dragged to cover the 19th to the 21st gets target: '2026-10-21'.

With only dateField, events move but cannot be resized. Pick a day (or a range) on the calendar and a new record lands on it, opened with its name ready to type. Colored by a single select, the events take the option colors and the options appear above the calendar as a legend that hides and shows them.

Moving and resizing need editable on the base. Without it the calendar is read-only.

A timeline puts the same bars in lanes: one row per value of laneField, so records that share a person, a property or a channel share a row, and the gaps between them show where there is room.

const occupancy: FieldView = {
  id: 'occupancy',
  name: 'Occupancy',
  type: 'timeline',
  dateField: 'checkIn',
  endField: 'checkOut',
  laneField: 'property',
  zoom: 'month',
}

Day, Week, Month and Year at the top right set the span. A bar dragged along its lane changes its dates; dragged to another lane it changes laneField too, in the same step, so one Ctrl+Z takes both back. For a link field with several records the record of the lane it left is swapped for the one it lands on, and the others stay. A double-click in a lane adds a record there, in that lane. With a single select or a person field every option or person is a lane, empty or not; with a link field the lanes are the records the rows link to, named by the linked table's primary field.

6. Effort by team

const effort: FieldView = { id: 'effort', name: 'Effort by team', type: 'chart', chart: { kind: 'barH', x: 'teams', y: 'effort' } }
const mix: FieldView = { id: 'mix', name: 'Features per quarter', type: 'chart', chart: { kind: 'donut', x: 'quarter' } }

A chart groups the records the view shows by x and adds up y (or counts records when there is no y). aggregation: 'avg' averages instead of summing. Kinds are 'bar', 'barH', 'line', 'pie' and 'donut'.

How x groups:

Values read as the summed field writes them, and a count as a whole number. The series is labeled "Sum of Effort (days)", "Average of ..." or "Records". The bar shows Filter, which narrows what is charted, and "Customize chart", whose Type, Group by, Value and Combine (sum or average) are kept in chart. A chart view declared without chart draws "Choose a field to chart in Customize chart." until a field is picked there.

Add an attachment field, then a gallery view with it as the cover:

const mockupField = { field: 'mockups', header: 'Mockups', fieldType: 'attachment' }
const gallery: FieldView = { id: 'mockups', name: 'Mockups', type: 'gallery', coverField: 'mockups' }

Each card shows the first image of mockups, the primary field as its title, then the fields the grid shows, each drawn as its cell draws it. Hide a field in this view and it leaves the cards; drag fields in Hide fields to reorder them. A click on a card opens the record. Without coverField the cards have no cover.

8. A request form

const request: FieldView = {
  id: 'request',
  name: 'Request a feature',
  type: 'form',
  formFields: ['feature', 'teams', 'impact'],
  formRequired: ['feature'],
  formTitle: 'Request a feature',
  formDescription: 'What should we build, and who is it for? Product reviews requests every Friday.',
  formSubmitLabel: 'Send request',
}

The form asks for the fields in formFields (column ids, in order), each with the editor its cell uses. Without it, the form asks for every field a person can fill in, the primary field first; computed fields are left out. A field in formRequired must be filled before the form sends. formTitle defaults to the view's name, formSubmitLabel to "Submit". A sent form adds a record the way "+ Add row" does: rowAdder.defaults first, so a request starts as Planned in Later, then what was typed, then onRowAdd. The bar shows only the view switcher on a form.

All the views so far, in one list:

let views = $state<FieldView[]>([roadmap, board, plan, effort, now, mine, gallery, request])

9. A dashboard

const OPEN: FieldFilter = { kind: 'fieldFilter', conjunction: 'and', conditions: [{ column: 'status', kind: 'select', op: 'isNot', value: 'Shipped' }] }
const SHIPPED: FieldFilter = { kind: 'fieldFilter', conjunction: 'and', conditions: [{ column: 'status', kind: 'select', op: 'is', value: 'Shipped' }] }

const overview: FieldView = {
  id: 'overview',
  name: 'Overview',
  type: 'dashboard',
  dashboard: [
    { id: 'open', kind: 'number', title: 'Open features', filter: OPEN },
    { id: 'days', kind: 'number', title: 'Days of work left', aggregation: 'sum', field: 'effort', filter: OPEN, caption: 'Team capacity 40 days' },
    { id: 'shipped', kind: 'progress', title: 'Shipped', filter: SHIPPED },
    { id: 'status', kind: 'chart', chart: { kind: 'bar', x: 'status' } },
    { id: 'wanted', kind: 'list', title: 'Most wanted', sortBy: 'votes', sortDesc: true, limit: 3 },
  ],
}

A dashboard is a grid of tiles. Each tile reads the records of one table, keeps the ones its filter matches (the same FieldFilter as a view's filter), and shows one of four things:

size is '1x1', '2x1' or '2x2' (columns by rows). A number or progress tile is '1x1' by default, a chart or list '2x2'. Below about 450px the tiles stack in one column. A tile without title is named after what it shows ("Total Effort (days)", "Status is Shipped").

With several tables (<SvBase bind:tables>), a tile's table names any table of the base, so a dashboard on Deals can count Accounts and list the Activities due this week. A tile without table reads the table the view is on. Its filter and fields are that table's.

A number or progress tile is a button: a click, or Enter, lists the records it counts ("Open the 3 records") in a dialog, each with its name and a few of its fields. On a chart, a click on a bar or a slice lists the records in it: the records the tile's filter keeps that fall in that bucket. A click on a record in the dialog opens it, in its own table's tab when the tile reads another table. While the dashboard is being edited, the tiles open nothing.

"Edit dashboard" at the top of the view adds a tile, and on each tile sets its size, moves it (drag it, or the arrows), edits it in a dialog (kind, table, value, filter, title, size) or removes it. Every change is saved in the view's dashboard at once and reaches onViewsChange and onTablesChange. A locked view has no "Edit dashboard". The view bar shows only the view switcher on a dashboard.

Open the live example: Base dashboard view (Base)

Text, buttons, images, dividers and a record picker

A dashboard can also say, show and link to things, which makes it a page of an app rather than only a summary (Airtable's "blank" interface layout):

const home: FieldView = {
  id: 'home',
  name: 'Home',
  type: 'dashboard',
  dashboard: [
    { id: 'hello', kind: 'text', text: '# Welcome\nYour open requests are below. See [the guide](https://example.com/guide).' },
    { id: 'help', kind: 'button', label: 'Ask for help', url: 'https://example.com/help' },
    { id: 'logo', kind: 'image', url: '/img/office.jpg', alt: 'Our office', fit: 'cover' },
    { id: 'sec', kind: 'divider', title: 'By account' },
    { id: 'account', kind: 'picker', table: 'accounts', title: 'Account', fields: ['city', 'owner'] },
    { id: 'deals', kind: 'number', title: 'Deals', pickedBy: { tile: 'account', field: 'account' } },
  ],
}

Links and pictures go only to https:, http:, mailto: (a link) or a path on the site: a javascript: or data: address is shown as words, not followed.

A number, chart, list or progress tile with pickedBy: { tile, field } is narrowed by that picker: once a record is picked, it counts only the records whose link field field holds it ("the deals of the account picked"), and "Every record" counts them all again. The pick is the viewer's and is not saved. Under the hood the tile's filter gains a condition of the kind 'linked':

const narrowing = { column: 'account', kind: 'linked', op: 'hasAnyOf', value: ['a1'] } // the link holds record a1, by id

For a table the page holds, the page applies it. For a table read from a server (serverRows), the server must apply it too: fieldFilterToSql and fieldFilterToPostgrest answer that they cannot (the tile then shows what the server sends), so a server of your own reads kind: 'linked' and matches the link's record ids.

In the tile dialog, "Shows" offers these kinds too; a picker's tile picks its fields, and the tiles it can narrow offer "Narrowed by" with each picker the tile's table links to. Dividers take one row across the dashboard; the other tiles keep their sizes.

10. A list for the phone

const list: FieldView = {
  id: 'list',
  name: 'Feature list',
  type: 'list',
  listFields: ['status', 'teams', 'votes'],
  state: { sorting: [{ id: 'quarter', desc: false }, { id: 'votes', desc: true }], grouping: ['quarter'], hiddenColumns: [], advancedFilter: null },
}

A list shows one record per entry: the primary field in bold, and under it the fields in listFields (column ids, in order), each drawn as its cell draws it, so Status is a colored pill and Teams are tags. An empty value is left out. Without listFields the list shows the next three fields the grid shows. Long names stay readable at phone width, where a grid would cut them.

The list keeps the view's filter, sorts and groups. Here it is grouped by Quarter: a header per quarter with the field's name, its value and the number of records, "Quarter Q4 2026 3", and a click on the header folds the group. Within each quarter the most voted feature comes first. Grouped by more fields (grouping: ['quarter', 'status']), each quarter holds a header per status, indented under it, with its own count and its own fold.

A click on a record, or Enter, opens it. The list is one tab stop: Up and Down move between records and group headers at every level, Home and End jump, Left and Right fold and unfold a group, and Left on a record or a folded group moves to the group it is in. A record someone else changed and nobody here opened yet has a dot before its name.

The view bar has Hide fields, Filter, Group, Sort and "Customize list", which turns the fields under the name on and off and saves them in listFields.

Open the live example: Base list view (Base)

11. An inbox of changes

const inbox: FieldView = {
  id: 'inbox',
  name: 'Inbox',
  type: 'inbox',
  inboxDateField: 'start',
  listFields: ['status', 'lead'],
}

An inbox shows the records on the left and the picked one on the right: its fields, each one editable in place with the editor its cell uses, and its latest changes, "Cleo Park changed Status: Planned → In progress". "Expand" opens the full record with its comments.

The list is newest first by inboxDateField (a date field's column id), so "Audit log export", which starts on January 11, is on top. Records without a date go last. Without inboxDateField the inbox keeps the view's sort. The view's filter applies either way.

A record someone else changed and nobody here has opened is unread: its name is bold and it has a dot. The changes come from a table with a source that hears of writes made elsewhere (Changes made elsewhere). Picking a record marks it read, as opening it in any view does, and "Mark all read" marks the rest. The count at the top says "2 unread" or "All read".

Down or j picks the next record and Up or k the previous one; Enter opens the full record. Narrower than 640px the inbox shows the list, and a picked record fills it with a Back button (Escape goes back too).

The view bar has Hide fields, Filter, Sort and "Customize inbox": the date field it lists by and the fields under each name. A field hidden in the view leaves the record on the right too.

Open the live example: Base inbox view (Base)

12. A tree of tasks

const tree: FieldView = {
  id: 'tree',
  name: 'Work breakdown',
  type: 'tree',
  parentField: 'parent',
}

A tree is a grid whose records nest under their parent: parentField is a link field to the same table, and a record sits under the one record it names, with an expander on the primary field. It opens unfolded. A record whose link names several records is at the top level, so no record goes missing. The records stay records: every cell edits as in a grid, and the footer and the view bar count them all, folded or not.

Building it by hand, every change is a write to parentField, so undo, the database and automations see a plain edit:

A record never goes under itself or one of its own subtasks: the move is refused with a notice.

The first time the view is kept, parentField gets its field back in the same table, Subtasks (addSubtasks(tables, tableId, fieldId) from @svgrid/enterprise/base does the same in code). It lists the records under each one, so a count or rollup of it adds them up: subtasks, their hours, their progress. It reads one level, the records directly under a record.

A filter or a search keeps each matching record under its parents: the parents that do not match stay in the tree, greyed, and are not counted (the grid's treeData.keepAncestors). A sort orders each level and keeps subtasks under their parent.

Creating a tree view asks for the link field. A table without a link to itself cannot have one: the type is greyed out, and says why. A table read a part at a time (serverRows) has no tree, since a tree needs every record at once: an existing tree view shows its records as a list.

13. A pivot of effort

const pivot: FieldView = {
  id: 'pivot',
  name: 'Hours by status and team',
  type: 'pivot',
  pivot: {
    rows: ['status'],
    cols: ['team'],
    values: [{ agg: 'count' }, { agg: 'sum', field: 'hours' }],
  },
}

A pivot adds up the records the view shows (its filter applies) by the fields down the side (rows, outermost first) and the one across the top (cols): a count of records, or a number field's 'sum', 'avg', 'min' or 'max'. Fields are grouped as a chart groups them: options in their order, people and linked records by name, dates by month, and a record with two options counts under each. Subtotals, a total row and, with a field across the top, a total column come with it.

Its own bar, over the table, changes the rows, the column field and the values; the view keeps them (onViewsChange). On a table read from a server a page at a time, it adds up the records loaded and says how many of how many.

14. Keep the views

onViewsChange fires with the whole list when a view is created, renamed, duplicated or deleted, and about 400ms after the shown view's settings stop changing. Switching views stores the one being left first. Store the list wherever the app stores things.

In the browser:

<script lang="ts">
  import { SvBase, enableBase, type FieldView } from '@svgrid/enterprise/base'

  enableBase()
  const KEY = 'roadmap:views'
  const DEFAULT_VIEWS: FieldView[] = [{ id: 'all', name: 'All features', type: 'grid' }]

  function read<T>(key: string, fallback: T): T {
    try {
      const raw = localStorage.getItem(key)
      return raw ? (JSON.parse(raw) as T) : fallback
    } catch {
      return fallback
    }
  }
  function write(key: string, value: unknown) {
    try {
      localStorage.setItem(key, JSON.stringify(value))
    } catch {
      // Private mode or a full quota: the views still work, unsaved.
    }
  }

  let views = $state<FieldView[]>(read(KEY, DEFAULT_VIEWS))
  let activeView = $state<string>(read(`${KEY}:active`, ''))

  $effect(() => write(`${KEY}:active`, activeView))
</script>

<SvBase data={rows} {columns} primaryField="feature" editable
  bind:views bind:activeView onViewsChange={(v: FieldView[]) => write(KEY, v)} />

On a server, decide who owns a list.

type Scope = 'me' | 'team'

async function loadViews(scope: Scope): Promise<FieldView[]> {
  const res = await fetch(`/api/tables/features/views?scope=${scope}`)
  return res.ok ? ((await res.json()) as FieldView[]) : DEFAULT_VIEWS
}

function saveViews(scope: Scope, next: FieldView[]) {
  void fetch(`/api/tables/features/views?scope=${scope}`, {
    method: 'PUT',
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify(next),
  })
}
{#await loadViews('me') then loaded}
  <SvBase data={rows} {columns} primaryField="feature" editable
    views={loaded} onViewsChange={(v: FieldView[]) => saveViews('me', v)} />
{/await}

Or mount at once and swap the list in when it arrives. When views or activeView changes from outside and the shown view is not the one the grid has, the bar applies it. It never stores the grid's settings into a view it has not applied yet.

<script lang="ts">
  let views = $state<FieldView[]>(DEFAULT_VIEWS)
  let loaded = false
  loadViews('me').then((v) => {
    views = v
    loaded = true
  })
</script>

<SvBase data={rows} {columns} primaryField="feature" editable
  bind:views onViewsChange={(v: FieldView[]) => loaded && saveViews('me', v)} />

The loaded check matters: about 400ms after mount the bar stores the default view's settings, and that save must not replace the list on the server before the real one is in.

With several tables (<SvBase bind:tables>), each table keeps its own views, and onTablesChange hands back the whole list of tables, views included.

Personal and locked views

Once several people share a table, two more keys on a view matter:

const views: FieldView[] = [
  // Only Ana sees it, under "My views" in the views menu.
  { id: 'ana-open', name: 'My open tasks', type: 'grid', personal: 'u1', state: { /* ... */ } },
  // Everyone sees it; nobody changes its settings until someone unlocks it.
  { id: 'report', name: 'Leadership report', type: 'grid', locked: true, lockedBy: 'u2', state: { /* ... */ } },
]

The lock button in the views menu locks the view as the grid shows it now, or unlocks it. lockViews={false} on SvBase removes it for people who may not lock views. Both keys come back through onViewsChange and onTablesChange, so the app stores a personal view with its owner the same way as the others.

Open the live example: Personal views, locked views, protected fields (Base)

On a phone

When a table is narrower than 600px (its own width, not the window's), a grid view shows each record as a card: the primary field, then the next four fields the view shows, each name beside its value so several records fit on the screen, in the view's filter and sort. A tap opens the record, "+" adds one, and on a phone screen the opened record fills it. The view bar keeps its icons and the tab bar its tabs.

A card keeps what a row can do. A long press, the button on the card, a right-click, the Menu key or Shift+F10 opens the record's menu: expand, comment, select, insert above or below, duplicate and delete. A record selected this way shows on its card, as a ring on its list row, and in the selection bar. Copy and paste work on a cell, so they stay with the table. A gallery view and a list view have the same menu.

Fields are added and changed from the fields button (Hide fields), since the cards have no column headers: "Add a field" at the foot of its list, and a pencil on each field to rename it or change its type. Both are there wherever fields may be changed (columnAdder, off without canEditSchema), on any screen, and open the same field editor as the header's "+" and field menu.

A Kanban lane takes the table's width, the next lane a swipe away and snapped into place. A calendar opens in its agenda, the days listed one under another, since a month of seven columns has no room for a title; Month, Week and Day are a tap away. Gallery cards stand one per row, and a form is one column at any width.

phoneLayout on SvBase moves the breakpoint (phoneLayout={480}), turns the cards on at every width (true) or keeps the grid (false). phoneGrid="grid" keeps a grid view a grid on a phone while the other views keep their phone layouts: a spreadsheet to scroll both ways, its first field pinned and drawn at most about two fifths of the width (maxPinnedColumnWidth on the grid, the field's own width kept), with "+" to add a record. A tap selects a cell and a second tap edits it.

Open the live example: Phone layout (Base)

Search across tables

The view bar's search finds records in the view on screen. The box at the end of the tab bar searches every table of the base. With the focus in the base, Ctrl+K puts the cursor in it, and so does "/" outside the grid and any text box. Neither is taken from the rest of the page.

It reads a field the way its cell shows it: a single select by its option's label, a person by name, a date as the field writes it, a link by the names of the records it links to, a formula or lookup by its result. Numbers, currency, percents, durations, ratings, checkboxes, buttons, rollups and counts are not searched. Case and accents do not count: "tomas" finds "Tomás".

Every word of the query has to be in the record, in one field or another. The results are grouped by table, five records each with "N more in Deals" under them, each with its name, the field the words were found in and the words marked. Records rank by:

  1. the whole query in one field, before words spread over several;
  2. the primary field, before the others;
  3. a field that is the query, then one that starts with it, then one with a word that starts with it, then one that holds it anywhere.

Tables are listed by their best record. Up and Down move through the list, Enter or a click shows the record's table and opens the record, and Escape closes the list, then clears the box. search={false} on SvBase leaves the box out. A shared base (readOnly) keeps it, over the tables and fields the share shows.

The same search runs without the box, for a command palette of your own or on a server:

import { searchBase } from '@svgrid/enterprise/base'

const groups = searchBase(tables, 'northwind proposal', { limit: 10 })
for (const g of groups) {
  console.log(g.name, g.total)
  for (const hit of g.hits) console.log(hit.rowId, hit.title, `${hit.fieldName}: ${hit.text}`, hit.marks)
}

Each hit has the table and record ids, the record's name (title), the field that matched (field, fieldName, primary), its text cut around the match when it is long, and marks, the [start, end) spans of the words in that text. field: (table, column) => boolean in the options picks the fields to search. To open a hit in SvBase, show its table (bind:activeTable) and call openRecord({ api, rowId }) once that table's grid has called onApiReady; the box does this for you.

Open the live example: Search across tables (Base)

View types and the keys they read

Type Keys View bar buttons
'grid' state, rowHeight, color Hide fields, Filter, Group, Sort, Color, Row height
'kanban' stackBy: a single select, or a user field with one person Hide fields, Filter, Sort
'calendar' dateField, endField (optional), color Hide fields, Filter, Sort, Color
'timeline' dateField, endField, laneField (a single select, person or link field), zoom (day, week, month, year), color Hide fields, Filter, Sort, Color, Customize timeline
'gantt' dateField, endField, progressField, dependencyField, zoom, color Hide fields, Filter, Sort, Color, Customize Gantt
'tree' parentField: a link field to the same table Hide fields, Filter, Sort, Color, Row height
'gallery' coverField: an attachment field Hide fields, Filter, Sort
'chart' chart: kind, x, y, aggregation Filter, Customize chart
'pivot' pivot: rows, cols, values ({ agg, field }) Filter; its own bar for rows, columns and values
'list' listFields: the fields under each name Hide fields, Filter, Group, Sort, Customize list
'inbox' inboxDateField: a date field, newest first; listFields Hide fields, Filter, Sort, Customize inbox
'form' formFields, formRequired, formTitle, formDescription, formSubmitLabel, formConditions, formPrefill none
'dashboard' dashboard: the tiles, in order none
any type personal, locked, lockedBy off while locked

Every type also keeps state (filter, sorts, groups, hidden fields, column order, widths, pinning) and switches with the grid's own state, so a filter set on the board is still there when you come back to it. The search text is not part of it. The views menu's "Create" offers each type SvBase can show and greys out one the table cannot: a Kanban needs a single select, a calendar a date field, a chart a field to group by. A new view starts with no filter, sorts or groups and every field shown. viewTypes={['grid', 'kanban', 'calendar']} on SvBase limits what "Create" offers.

A Gantt chart (type: 'gantt') is one bar per record with a task table beside the bars. "Create" offers it as Gantt in every base, and its renderer loads the first time one is shown. A timeline (type: 'timeline') is the other kind of plan: records in lanes by laneField, several to a lane, as Airtable's Timeline view draws them; an Airtable Timeline view converts to it, and an Airtable Gantt to a Gantt. Its bars take the view's colors, progressField is a percent field drawn as each bar's fill, and dependencyField is a link field to the same table naming what each record waits for, drawn as arrows. With a dependency field, criticalPath: true ("Show the critical path" in Customize Gantt) outlines the tasks that set the finish in red, and each other task's tooltip says how many days it can slip.

A record's dates are its own: a drop on a Sunday stays on the Sunday. By keyboard a bar works as a calendar event does: Space picks it up, Left and Right carry it a day (Shift, a week), Space puts it down and Escape puts it back. Enter opens the record, Shift+F10 opens its menu, and Delete asks first, as a row's menu does.

When an edit changes where a record belongs

A view's filter, sort and groups apply again after an edit, with one pause. In a grid the row you are working in stays where it is while it is the active row, so it does not leap away under the cursor; it takes its place when you move to another row, click outside the grid, or close its record. The record count follows at the same moment. An undo, a paste and a fill apply at once. A board, a calendar, a timeline, a gallery and a list show the change as soon as it is made, or when a record dialog closes. On a table read a page at a time the database is asked again at that moment, once it has the edit.

The view bar, panel by panel

A button with something set says so and is tinted. With fieldMenu on, each column's menu adds "Filter by this field" and "Group by this field", which open the bar's panel with the new condition or group in it.

Filters in code

filterKindOf(columnDef) gives the kind a field filters as, and operatorsFor(kind) the operators the panel offers for it, in menu order. Filter conditions maps each field type to its kind.

kind op values value
'text', 'link' contains, notContains, is, isNot a string; a link compares the linked records' names
'number' eq, neq, lt, gt, lte, gte a number
'select' is, isNot one option value, or a person's id (or ME) for a user field
'select' isAnyOf, isNoneOf an array of them
'multi' hasAnyOf, hasAllOf, isExactly, hasNoneOf an array of option values or ids
'checkbox' is true or false
'date' is, isBefore, isAfter, isOnOrBefore, isOnOrAfter { mode: 'today' }, with mode also 'tomorrow', 'yesterday', 'oneWeekAgo', 'oneWeekFromNow', 'oneMonthAgo', 'oneMonthFromNow'; or { mode: 'exactDate', date: '2026-11-01' }
'date' isWithin { span: 'pastWeek' }, with span also 'pastMonth', 'pastYear', 'nextWeek', 'nextMonth', 'nextYear'; or { span: 'pastDays', days: 14 }, { span: 'nextDays', days: 14 }
'files' contains (file name contains) a string

Every kind except checkbox also takes isEmpty and isNotEmpty, with no value. A few rules from the code:

Set a filter on the shown view with api.setAdvancedFilter(filter); the view keeps it like one set in the panel.

Row colors: by field or by conditions

import type { ColorSetting } from '@svgrid/enterprise/base'

const byStatus: ColorSetting = { mode: 'field', field: 'status' }
const byRisk: ColorSetting = {
  mode: 'conditions',
  rules: [
    { color: '#f82b60', condition: { column: 'status', kind: 'select', op: 'is', value: 'Blocked' } },
    { color: '#fcb400', condition: { column: 'target', kind: 'date', op: 'isBefore', value: { mode: 'today' } } },
  ],
}

By field, each row takes its option's color, and the row header's title says the option, so the color is never the only signal. A multiple select colors by its first value. By conditions, the first rule that matches wins: a blocked feature is red even when it is also late. A condition is tested as the filter tests it: on the value the cell shows, so a formula, lookup, rollup or count field works, and a condition still missing its value colors nothing. A calendar colors its events by a single select only; a Gantt's bars take either kind.

The color is a 3px stripe on the row header, unless the rowColor prop on SvBase sets a target ('bar' or 'row'): a view's colors use it too. A view without color shows the rowColor prop's colors until someone picks colors for it in Color. { mode: 'none' } turns the colors off in that view.

With summary on, a click on a field's footer cell picks its summary: sum, average, median, min, max or range for numbers; checked, unchecked or percent checked for a checkbox; earliest, latest or the date range in days for dates; empty, filled, unique, percent empty or percent filled for any field. The result is written as the field writes values. The choice is stored in the field's fieldProps.summary and reported through onColumnChange; see Summaries at the bottom.

Group headers show the same summaries over that group's records. Both leave out records the filter hides, even in a collapsed group.

The view bar over your own grid

SvBaseViewBar is the bar alone, for a page that lays out its own <SvGrid>:

<script lang="ts">
  import { SvGrid } from '@svgrid/grid'
  import { SvBaseViewBar, enableBase, type FieldView } from '@svgrid/enterprise/base'

  enableBase()
  // Raw: the bar finds its grid by the api object itself, and a proxy is another object.
  let api = $state.raw<any>(null)
  let views = $state<FieldView[]>([
    { id: 'all', name: 'All features', type: 'grid' },
    { id: 'board', name: 'Status board', type: 'kanban', stackBy: 'status' },
  ])
  let activeView = $state('all')
</script>

{#if api}
  <SvBaseViewBar {api} bind:views bind:activeView
    rowHeights={[{ label: 'Compact', height: 32 }, { label: 'Roomy', height: 64 }]} />
{/if}
<SvGrid data={rows} {columns} primaryField="feature" editable containerHeight={600}
  onApiReady={(a) => (api = a)} />

Its "Create" offers grid, Kanban and calendar (and Gantt once enabled). It loads the board, calendar and gallery renderers the first time a view of that type is shown, and opens the record and the "Delete record?" question for a card's menu. Chart and form views are drawn by SvBase, not by the bar, so leave them out of viewTypes here, or draw SvBaseForm yourself when a form view is active.

Sections in the views menu

A table with many views groups them in sections, as Airtable does: a shared view's section lists it under that heading in the views menu, after the views with none and before "My views". A heading folds its views, except the one on screen. Whoever may manage views moves one into a section, or out of it, with the folder button on its row; the box offers the sections there are.

views: [
  { id: 'all', name: 'All tasks', type: 'grid' },
  { id: 'q1', name: 'Q1 plan', type: 'grid', section: 'Planning' },
  { id: 'late', name: 'Late', type: 'grid', section: 'Reports' },
]

Your own actions on a view

setViewActions adds buttons of the app's to each saved view in the views menu, beside rename and duplicate, for everyone who sees the view: "Subscribe in your calendar app" on a calendar view, "Copy a link", "Export". The function is called for each view with its table's id and answers the view's actions (none: []).

import { setViewActions } from '@svgrid/enterprise/base'

setViewActions((view, tableId) =>
  view.type === 'calendar'
    ? [{ id: 'feed', label: 'Subscribe in your calendar app', icon: 'M4 6h16v14H4zM4 10h16M8 3v4M16 3v4', run: () => openFeed(tableId, view.id) }]
    : [],
)

icon is an SVG path on a 24 by 24 box. setViewActions(null) takes them away; a function that throws gives none.

Your own actions on a record

setRecordActions does the same for records: the app's actions show in a record's right-click menu (a grid row, a gallery or board card) and at the top of the record view, and run with the table's id, the record's id and the record.

import { setRecordActions } from '@svgrid/enterprise/base'

setRecordActions((tableId) => [
  { id: 'print', label: 'Print', icon: 'M4.5 6V2.5h7V6M4.5 12H3V7.5h10V12h-1.5M5 10h6v4H5z', run: ({ tableId, rowId }) => window.open(`/print/${tableId}/${rowId}`) },
])

icon is an SVG path on a 16 by 16 box. setRecordActions(null) takes them away.

In the record view the function is also told the record it shows, so an action can depend on it: "Stop notifications" on a record you follow, "Notify me" on one you do not. The right-click menu tells it no record; return none there for actions that need one.

setRecordActions((tableId, record) =>
  record ? [{ id: 'follow', label: followed.has(record.rowId) ? 'Stop notifications' : 'Notify me', run: ({ rowId }) => toggleFollow(rowId) }] : [],
)

Repeating records on a calendar, timeline or Gantt

The app decides which records repeat ("every Monday", "the 1st of each month"). setRecordSeries hands calendar, timeline and Gantt views the upcoming occurrences that are not records yet. A view draws them lighter than records, with a dashed outline. A screen reader says "upcoming" after each one. The record itself still shows on its own date.

import { setRecordSeries, refreshRecordSeries } from '@svgrid/enterprise/base'

setRecordSeries({
  // Occurrences whose dates fall in [from, to]. values are by field id.
  occurrences: (tableId, from, to) => api.repeats(tableId, from, to), // [{ rowId, day: '2026-12-07', values: { due: '2026-12-07' } }]
  open: (tableId, occ) => openRepeat(tableId, occ),
  move: async (tableId, occ, scope, values) => { await api.moveRepeat(tableId, occ, scope, values); refreshRecordSeries(tableId) },
  remove: async (tableId, occ, scope) => { await api.skipRepeat(tableId, occ, scope); refreshRecordSeries(tableId) },
})

setRecordSeries(null) takes them away.

When the app changes records through a request of its own (a button, a panel like the one open shows) and hands the page the new record through the table's realtime, it marks the change mine: true. The page puts it in like any change and never shows it as changed by someone else.

Pitfalls

Next

Live examples

  • Product roadmap - A product roadmap, ready to use: Features and customer Feedback as two linked tables. Features have quarter, status, teams, lead, impact, effort and votes. Views for the roadmap grouped by quarter, a status board, a timeline, the work in progress now and a request form.
  • Base dashboard view - A dashboard view over a sales base: the open pipeline and what was won as money, the share of deals won, charts by stage and by industry, the biggest open deals and the activities due this week. Each tile reads its own table with its own filter, and Edit dashboard adds, resizes, moves and removes tiles.
  • Base list view - A product feedback base as a list: one record per entry, its name in bold over the fields the view picks, grouped by area with folding headers and sorted by votes. Click or Enter opens a record, Up and Down move, and Customize list picks the fields.
  • Base inbox view - A support queue as an inbox: tickets newest first on the left, the picked one on the right to read and edit. Tickets a teammate changed in the database show unread, bold with a dot, until opened; j and k step through them and Mark all read clears the rest.
  • Personal views, locked views, protected fields - A personal view shows only for the person it belongs to, under My views; a locked view keeps its filter, sorts, groups and colors and says who locked it, while records stay editable; a protected field takes edits only from the people it lists. Switch who is signed in to see each person's own views, who may lock them, and who may set Priority.
  • Phone layout - The same base at phone, tablet and desktop width. Narrower than 600px a grid view shows each record as a card with its name and the next four fields, in the view's filter and sort; a tap opens the record and + adds one. The view bar keeps its icons and on a phone the record fills the screen.
  • Search across tables - One box in the tab bar searches every table: deals, contacts and companies, by what their cells show, a stage label, an owner name, a date, a linked company. Results come grouped by table with the words marked and the field they matched in; Up, Down and Enter open a record in its own table, and Ctrl+K focuses the box. searchBase runs the same search headless.

Related articles