A powerful, high-performance data grid component for Svelte 5.
Features are implemented in order of complexity. Each category must pass all tests and benchmarks before proceeding.
Core behaviors most grids need early.
Straightforward, but needs careful state handling.
UI + data model complexity rises; correctness matters.
Where "table" becomes a real "grid." Much more edge-case heavy.
Hard mainly because they interact with scrolling, virtualization, and measurement.
This is where grids become "high performance."
Powerful but expensive: complex state models + UI + server integration.
Must be designed in early for virtualized grids.
What makes a grid "best-in-class."
<script>
import { DataGrid } from 'svelte-datagrid';
const data = [
{ id: 1, name: 'Alice', age: 30 },
{ id: 2, name: 'Bob', age: 25 },
{ id: 3, name: 'Charlie', age: 35 },
];
const columns = [
{ key: 'id', header: 'ID', width: 80 },
{ key: 'name', header: 'Name' },
{ key: 'age', header: 'Age', width: 100 },
];
</script>
<DataGrid {data} {columns} height={400} selectable="multiple" />
selectable="multiple"// In your component
gridState.setColumnVisibility('columnKey', false); // Hide column
gridState.setColumnVisibility('columnKey', true); // Show column
Click column headers to sort. Hold Shift to multi-sort.
Enable per-column filters with filterable:
<DataGrid {data} {columns} filterable />
Supported filter types (set via column.filterType):
Enable a search bar that searches across all columns:
<DataGrid {data} {columns} searchable />
The grid includes a backend-agnostic query module for server-side data:
import { createLocalDataSource, createPostgresDataSource } from 'svelte-datagrid/query';
// In-memory data source
const localDs = createLocalDataSource(myData, 'id');
// PostgreSQL data source (works with pg, PgLite, Neon, etc.)
const pgDs = createPostgresDataSource({
connection: pool, // Any client with query(sql, params) method
table: 'users'
});
pnpm install
pnpm dev
pnpm test # Run unit tests
pnpm e2e # Run end-to-end tests
pnpm bench # Run performance benchmarks
pnpm bench:ci # Run benchmarks with regression detection