Reference v1.3.0

API Reference

Everything the package exports, in one place. The surface is deliberately small: enough to render a grid, enough to write a feature module, and nothing else.

Entry Points

Three, and nothing else is importable. There is no demo to run here: an import either resolves or it does not.

SpecifierHolds
@sv5ui/datagridcreateDataGrid, DataGrid, Grid, every feature and every accessor, plus the types behind them
@sv5ui/datagrid/localesThe twelve language packs, imported one at a time so only what you use ships
@sv5ui/datagrid/theme.cssThe stylesheet, imported once in your app
// Everything public comes from the package root
import {
  DataGrid, Grid, createDataGrid,
  sorting, filtering, selection, getSorting, getSelection,
  type ColumnDef, type GridState
} from '@sv5ui/datagrid';

// Except the language packs, which have their own entry point so that a
// pack nobody imports is never bundled
import { enUS, viVN } from '@sv5ui/datagrid/locales';

// And the stylesheet, next to the sv5ui one
// @import '@sv5ui/datagrid/theme.css';

Components and Theming

ExportWhat it is
DataGridThe whole grid, in either the shorthand or the instance form
GridRoot, Viewport, Header, FilterRow, Body, Toolbar, QuickFilter, FilterChips, ColumnChooser, DensityToggle, ExportMenu, ContextMenu, StatusBar, Pagination. Header draws FilterRow itself, so that part is only for a header of your own
defineDataGridConfigApp-wide defaults for density and slots
resetDataGridConfigRestores the built-in defaults. Mainly for tests
registerDataGridIconsRegisters the bundled icons. Idempotent, and only needed for a grid behind a dynamic import that may load after your own icons render
datagridIconsThe icon set itself, for an app that registers icons its own way

The Grid and Its Constants

ExportWhat it is
createDataGridCreates a grid: state plus a derived row pipeline
getCellValueA cell value from a row and a column definition
PIPELINE_ORDERfilter 100, sort 200, group 300, flatten 400, pinSplit 500, window 900
SNAPSHOT_VERSIONThe version a snapshot is written with
SELECTION_COLUMN_IDThe id of the synthetic checkbox column
defaultLabels / mergeLabelsThe English strings, and how overrides fold onto a pack

Feature Modules

Each pairs a factory with an accessor: the factory registers it, the accessor is the typed way back to its state.

Factory and accessorAdds
sorting / getSortingMulti-sort, cycles, null ordering
filtering / getFilteringQuick filter and five column filter kinds
columnOps / getColumnOpsResize, reorder, pin, hide, autosize
selection / getSelectionSelection, clipboard and CSV export
editing / getEditingCell and row editing with validation and undo
pagination / getPaginationClient paging and the server hooks
virtualization / getVirtualizationRow and column virtualization
rowPinning / getRowPinningRows pinned outside filter and sort
rowReorder / getRowReorderDrag and keyboard row reorder

Helpers

The pieces the grid uses on itself, exported so a custom renderer or a custom export path can use the same ones.

ExportWhat it does
getValue(node, column, purpose?)One cell as a purpose is allowed to see it. The default is what the cell draws; 'export', 'clipboard', 'search', 'facet' and 'edit' are the other ways out
readerFor(columnId, purpose?)The cellValue gate standing in front of one column, or undefined. Hoist it out of a loop over rows: it is fixed for the column
toggleGroup / setGroupCollapsedFolds a header group, on grid.api and on getColumnOps(grid). Both announce and emit columnGroupToggled
toFilterRequest(model, quickFields?)The filter as it leaves for a server: always a list and a join, plus the fields a bare query applies to
toSortRequest(sort, defs, nulls?)The sort as it leaves for a server: each column's sortField in priority order, with the side blanks land on written on every entry
toCsv / toTsvA matrix into a CSV or TSV string. toCsv takes its delimiter as an argument and neutralizes spreadsheet formulas itself
rowsToMatrix / withHeaderRow / pickColumnsThe export path in pieces, for a format the grid does not produce. pickColumns may name hidden columns
getCellValueA cell value from a row and a column definition, accessor included
registerDataGridIcons / datagridIconsThe bundled icon set. The import registers it; only a grid behind a dynamic import needs the call

Types

Grouped by what they describe. Feature state classes and grid models are exported as types only.

TypesDescribe
ColumnDef / ColumnState / ColumnType / ColumnTypeOptions / ColumnAlign / PinnedSideColumns as declared and as resolved, with the two enums they read from
DataGridCellContext / HeaderContext / HeaderGroupCell / HeaderGroupContextWhat a cell snippet, a header snippet and a group header snippet receive, and the group cell itself
BadgeColor / RowAction / EditorOption / DensityThe small unions the built-in renderers, the actions column and density read
DataGridProps / GridRootProps / GridBodyProps / GridPaginationProps / GridQuickFilterProps / GridFilterRowProps / GridExportMenuProps / GridContextMenuProps / GridParts / DataGridFullWidthContextComponent props worth naming, the Grid namespace itself, and the context a full-width row snippet receives. Everything else takes ComponentProps
DataGridUi / DataGridSlots / DataGridConfigTheming
GridState / GridApi / GridFeature / GridEventMap / GridSnapshot / DataGridOptions / PersistStateOptionsThe grid, its api, a feature, its events, its snapshot, what createDataGrid takes and what persistState takes
PipelineStage / MenuContext / MenuItem / Keybinding / CellDecoration / CellDecorationContext / EventHandlerEverything a feature module declares, and the handler an event takes
CellValuePurpose / CellValueScope / CellValueReaderThe cellValue gate: which way out of the grid is being asked about, what the hook is handed, and the reader it returns
CellPosition / GridSection / VirtualRange / ColumnVirtualizer / ColumnVirtualizationOptionsWhere focus is, which band it is in, and the windows the virtualizers expose
RowNode / RowMeta / RowModel / RowPinSideRows as the pipeline sees them
SortState / SortDirection / SortRequestEntry / SortNulls / SortCycle / ToggleSortOptionsSorting, including the wire shape and what toggleSort takes
FilterModel / ColumnFilter / ColumnFilterEntry / ColumnFilterGroup / ColumnFilterDef / FilterType / FilterJoin / SetFilterValueFiltering as the model holds it, per column and per condition
FilterRequest / FilterRequestEntry / TextFilterOp / NumberFilterOp / DateFilterOp / PresenceFilterOpThe wire shape a server row model sends, and every operator name in it
EditorType / EditorContext / ColumnEditorDef / EditTransaction / Editable / EditModeEditing, from what opens to what a commit produces
SelectionMode / SelectAllState / CopyOptions / ExportCsvOptions / ExportFormatter / CellMatrixSelection and the clipboard and CSV paths it drives
RowDragStateThe drag in flight, for a row reorder indicator of your own
DataGridLabels / DataGridLabelsInput / DataGridLocalePack / DataGridAnnouncerStringsLocalization
Sorting / Filtering / Selection / Editing / Pagination / Virtualization / ColumnOps / RowPinning / RowReorderFeature state classes, as types only
ColumnModel / FocusModel / ExpansionModel / Announcer / EventBus / VirtualizerModels reachable from a grid, as types only

Stability

Everything above is public and covered by semver. This is version 1.3.0, so a breaking change to any of it waits for 2.0. Internal helpers stay unexported and change freely between releases.

Semver is a promise about numbering rather than about mileage. The surface below is what the library commits to; how much of it has been through a real application is another question, so pin the exact version and read the changelog before upgrading.

If you need something unexported in order to build a feature, that is a gap in the extension points rather than a reason to reach into dist.

Row grouping, tree data, master and detail rows, range selection and infinite scroll are not in this package, and are planned for a separate pro package.

// Public and covered by semver from 1.0 on: everything exported from the
// package root, and the two entry points above.

// Not public, and free to change between releases: pipeline transforms,
// filter compilation, the undo stack, column sizing maths, scroll
// normalization, and every file path inside dist.

// Classes the grid constructs are exported as types only. You reach an
// instance through the grid or through its accessor:
import { getSelection, type Selection } from '@sv5ui/datagrid';

const selection: Selection<Person> | undefined = getSelection(grid);
// new Selection(...) is not something the package offers.