LatticeGrid
Tables and data grids, with every grid feature. Rows and columns are virtual, and any gts component can be a cell.
Data views for Ember 6.12 and later Preview
Lattice ports TanStack Table and TanStack Virtual to Ember. It adds the features of AG Grid Community and Enterprise, under the MIT licence. Each view reads the same data source.
pnpm add @ember-lattice/core @ember-lattice/ember @ember-lattice/theme
| Order | Customer | Status | Total |
|---|---|---|---|
| 1041 | Ada Lovelace | New | 120.00 |
| 1042 | Grace Hopper | Packed | 86.50 |
| 1043 | Alan Turing | Shipped | 240.00 |
| 1044 | Edsger Dijkstra | New | 54.25 |
| 1045 | Barbara Liskov | Shipped | 310.00 |
| A | B | C | |
|---|---|---|---|
| 1 | Order | Customer | Total |
| 2 | 1041 | Ada Lovelace | 120.00 |
| 3 | 1042 | Grace Hopper | 86.50 |
| 4 | 1043 | Alan TuringSam | 240.00 |
| 5 | 1044 | Edsger Dijkstra | 54.25 |
| 6 | 1045 | Barbara Liskov | 310.00 |
| 7 | Sum | 810.75 |
A picture of the surfaces. The demos run each one live.
One engine
Each surface reads the same table: the same columns, row models, sorts, filters and state. Thus one data set can show as a table, a list or a board, and an edit on the board is an edit of the data.
LatticeGrid
Tables and data grids, with every grid feature. Rows and columns are virtual, and any gts component can be a cell.
LatticeList
Lists and feeds: rows of different heights, masonry lanes, card grids and loads in two directions.
LatticeBoard
Kanban lanes by a group field. Move a card to a different lane, by pointer or by keyboard, to edit that field.
LatticeSheet
A spreadsheet: A1 headers, a formula bar, sheet tabs, frozen panes, merges and a fill handle, on IronCalc.
The engine keeps the words of TanStack Table: column defs, features, row models and state atoms. It has no dependency on a TanStack package. See the introduction and the surfaces.
AG Grid parity
The parity matrix compares Lattice with AG Grid 36.3.0, Community and Enterprise. Each row names the test that proves it. There is no paid tier.
80features done
81features in the matrix
0features behind a license key
Read the parity matrix, or migrate from AG Grid. The AG Grid AI toolkit is not in the matrix: Marquetry does that work.
Data
The Lattice protocol is one request for rows: a range or a cursor, sorts, one filter tree, groups, aggregates and pivots. Three server packages answer it from SQL, and all three pass the same conformance suite.
| Server | Package | Query layer | Live collaboration |
|---|---|---|---|
| Node |
@ember-lattice/server on npm
|
Kysely: Postgres, SQLite and MySQL | A WebSocket doc server |
| Rails | lattice-grid gem |
Arel and ActiveRecord | An Action Cable channel |
| Python |
lattice-grid on PyPI
|
SQLAlchemy 2 Core | An ASGI WebSocket app |
On the client, one DataSource interface has adapters for fetch,
WarpDrive, GraphQL Relay connections and an existing AG Grid server-side row model
backend. Read the protocol and
the servers.
Sheet
LatticeSheet runs IronCalc, an MIT formula engine in WebAssembly, in a
worker. The servers run the same IronCalc module, so the client and the server compute the
same values.
IronCalc has 176 of 178 common functions. In a test of 71,661 formula cells, 99.81% gave the same value as Excel.
The server orders each op in a log and sends it to every client. A client shows its own edit at once, then rebases it on the server ops.
Each user has a colour, a cursor and a selection. The others see them as outlines with a name, over the same socket.
The sheet stores each reference by row and column ID, so it stays correct when rows and columns move. The sheet also has number formats, conditional formats, data validation, notes and named ranges. Read the sheet page.
Styles
@ember-lattice/theme reads the
Joinery tokens. Each Joinery theme,
style and the dark mode work with no more configuration. This page uses the same tokens.
Presets, as attributes
| Attribute | Values |
|---|---|
data-lt-density
|
compact, normal, comfortable |
data-lt-borders
|
none, rows, cells |
data-lt-zebra
|
a background on every second row |
data-lt-preset
|
sheet: A1 grid lines |
Tokens, as CSS
.orders {
--lt-row-height: 28px;
--lt-header-bg: var(--muted);
--lt-range-bg: color-mix(in oklab, var(--primary) 8%, transparent);
}
All rules are in the lattice cascade layer, inside :where(). One
class of your own CSS wins. Light, dark and high contrast work in each preset. Read
styles.
Accessibility
Lattice follows the WAI-ARIA Authoring Practices. Every render test of Lattice, and every example of the guide, ends with an axe audit.
grid, or a treegrid with groups. It has
one tab stop and the full APG keyboard.
aria-rowcount and aria-colcount give the full size, also for a
virtual grid of a million rows.
list, a feed or a listbox.Read accessibility.
Performance
Lattice renders only the rows and columns in view. These numbers come from the ADRs in the repository. Each one names its machine and its conditions.
| Measure | Result | Conditions |
|---|---|---|
| Live updates, viewport row model | 1,000 row updates a second, 0 of 121 frames dropped | The test browser (ADR 0010) |
| Sheet edit to paint, 100,000 formula cells | Median 83 ms, 0 long tasks | IronCalc in a worker, production build, headless Chromium, Apple M4 (ADR 0017) |
| 50 viewport jumps | Hybrid rows 147 to 306 ms, new rows each time 645 to 937 ms | Headless Chrome, median of 5, four runs on a loaded machine (ADR 0002) |
| Reactivity, 100,000 rows | One tag for each row: 7 ms and 42 MB to make |
Apple M4, Node 24. One @tracked for each of 1,000,000 cells took 720
ms and 570 MB (ADR 0001)
|
The first-render gate (50,000 rows) and the scroll gate (1,000,000 rows) have no result yet. Read performance for the gates and the rules for fast grids.
Get started
Lattice needs ember-source 6.12 or later, with Embroider and Vite. Install the engine, the surfaces and the theme, and the Joinery tokens.
pnpm add @ember-lattice/core @ember-lattice/ember @ember-lattice/theme
pnpm add @ember-joinery/ember
Load the styles
@import '@ember-joinery/ember/tokens.css';
@import '@ember-joinery/ember/themes/zinc.css';
@import '@ember-joinery/ember/joinery.css';
@import '@ember-lattice/theme/lattice.css';
The first grid
import { constructTable, emberReactivityBindings, tableFeatures } from '@ember-lattice/core'
import { LatticeGrid } from '@ember-lattice/ember'
const table = constructTable({
features: tableFeatures({ coreReactivityFeature: emberReactivityBindings() }),
data: orders,
columns: [
{ id: 'id', accessorKey: 'id', header: 'Order' },
{ id: 'customer', accessorKey: 'customer', header: 'Customer' },
{ id: 'total', accessorKey: 'total', header: 'Total' },
],
})
<template>
<div class='orders'><LatticeGrid @table={{table}} @label='Orders' /></div>
</template>
Give the grid a parent with a height, and a label. Load joinery.css only if
your app uses the Joinery components. Read
installation, the
API reference, the
demos and the stories.
Ember Workbench
Lattice is one of the tools on the Ember Workbench. It uses most of its siblings.
The tokens, themes and primitives under each Lattice surface.
The cell editors, and the forms for row and popup edit.
The state machines for edit, load, drag and resize, and the announcer.
Column types from codecs: money, decimals, dates and more.
Enum columns, with their order, labels and set filter options.
The test harnesses of @ember-lattice/test-support.
A model streams a spec, and Marquetry renders it as a Lattice grid.
Feature flags for Ember and the server, from the same bench.