Skip to content

Plugins Overview

The @toolbox-web/grid plugin architecture allows you to extend the grid with powerful features while keeping the core bundle lightweight. Plugins are tree-shakeable — only import what you need.

PluginDescription
EditingInline cell editing with built-in editors
Undo/RedoUndo/redo for cell edits with history stack
PluginDescription
SelectionCell, row, and range selection with keyboard support
ClipboardCopy/paste with Ctrl+C/V
Context MenuRight-click context menus with submenus
ReorderDrag-and-drop column reordering
Row ReorderDrag-and-drop row reordering with keyboard support
PluginDescription
FilteringColumn header filters with search and dropdown
Multi-SortSort by multiple columns with priority indicators
PluginDescription
Row GroupingGroup rows by field values with expand/collapse
Column GroupingVisual column grouping with nested headers
TreeHierarchical tree data display
Master-DetailExpandable detail rows
PivotPivot table transformation with aggregations
PluginDescription
Pinned ColumnsPin columns to left or right edge
Pinned RowsStatus bar with aggregations and custom panels
VisibilityShow/hide columns dynamically
Column VirtualizationPerformance optimization for many columns
ResponsiveCard layout for narrow containers and mobile
PluginDescription
ExportExport to CSV, Excel (XML), and JSON formats
PrintPrint-optimized layout with styling
Server-SideLazy loading from remote data sources

Some plugins depend on other plugins to function. Dependencies can be hard (required) or soft (optional enhancement).

TypeBehaviorExample
Hard (Required)Plugin will throw an error if the dependency is missingUndoRedoPlugin → EditingPlugin
Soft (Optional)Plugin works without it, but gains extra features when presentVisibilityPlugin → ReorderPlugin
PluginDepends OnTypeReason
UndoRedoPluginEditingPluginHardTracks cell edit history for undo/redo
ClipboardPluginSelectionPluginSoftEnables copy/paste of selected cells instead of entire grid
VisibilityPluginReorderPluginSoftEnables drag-to-reorder columns in visibility panel

When using the features API (recommended), dependencies are resolved automatically — you don’t need to worry about ordering.

When using the plugin API directly, dependencies must be loaded before the dependent plugin:

// ✅ Correct - EditingPlugin loaded before UndoRedoPlugin
plugins: [
new EditingPlugin(),
new UndoRedoPlugin(),
]
// ❌ Wrong - throws error at runtime
plugins: [
new UndoRedoPlugin(), // Error: EditingPlugin required
new EditingPlugin(),
]

For declaring dependencies in your own custom plugins, see Custom Plugins → Plugin Dependencies.

The features API is the simplest and recommended way to enable grid capabilities. It provides:

  • Declarative configuration — describe what you want, not how to wire it up
  • Automatic dependency resolution — features auto-resolve plugin dependencies in the correct order
  • Tree-shaking via side-effect imports — only the features you import are included in your bundle
  • Framework adapter integration — React, Vue, and Angular adapters expose features as typed props
// 1. Import features (side-effect imports for tree-shaking)
import '@toolbox-web/grid/features/selection';
import '@toolbox-web/grid/features/filtering';
import '@toolbox-web/grid/features/editing';
// 2. Configure declaratively
grid.gridConfig = {
columns: [...],
features: {
selection: 'row', // shorthand
filtering: { debounceMs: 300 }, // full config object
editing: 'dblclick', // shorthand
},
};

For rapid prototyping when bundle size is not critical:

import { SelectionPlugin, FilteringPlugin, EditingPlugin } from '@toolbox-web/grid/all';

This imports the core grid and all 22 plugin classes. Use the plugins array to configure them:

grid.gridConfig = {
plugins: [
new SelectionPlugin({ mode: 'row' }),
new FilteringPlugin(),
new EditingPlugin({ editOn: 'dblclick' }),
],
};

Whether you use features or plugins, access runtime APIs the same way:

const selection = grid.getPluginByName('selection');
if (selection) {
selection.selectAll();
selection.clearSelection();
const ranges = selection.getSelectedRanges();
}

For building custom plugins or when you need to instantiate plugin classes yourself (e.g., to pass constructor-only options or extend BaseGridPlugin), use the plugin API directly. The result is identical to using features — this is just a different way to configure the same capabilities.

The grid package provides multiple entry points for different use cases:

Entry PointWhat It IncludesTree-Shaking
@toolbox-web/gridCore grid only (auto-registers <tbw-grid>)N/A
@toolbox-web/grid/allCore + all plugins bundledNo
@toolbox-web/grid/plugins/*Individual plugin (e.g., /plugins/selection)Yes

Important: Do not import from both @toolbox-web/grid and @toolbox-web/grid/all in the same application. The all entry point already includes the core grid, so importing both will register the custom element twice.

For production apps using plugin API directly (best tree-shaking):

// Import core grid
import '@toolbox-web/grid';
// Import only the plugins you need
import { SelectionPlugin } from '@toolbox-web/grid/plugins/selection';
import { FilteringPlugin } from '@toolbox-web/grid/plugins/filtering';
import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';

For prototyping (includes core grid + all plugins):

// Import everything at once (includes core grid + all plugins)
import { SelectionPlugin, FilteringPlugin, EditingPlugin } from '@toolbox-web/grid/all';

Pass plugin instances to the gridConfig.plugins array:

import { queryGrid } from '@toolbox-web/grid';
const grid = queryGrid('tbw-grid');
grid.gridConfig = {
columns: [...],
plugins: [
new SelectionPlugin({ mode: 'row' }),
new FilteringPlugin({ debounceMs: 300 }),
],
};

Each plugin accepts a configuration object:

// Selection plugin options
new SelectionPlugin({
mode: 'row',
multiSelect: true,
checkbox: true,
});
// Filtering plugin options
new FilteringPlugin({
debounceMs: 200,
caseSensitive: false,
});
// Export plugin options
new ExportPlugin({
fileName: 'grid-export',
includeHeaders: true,
onlyVisible: true,
});

The grid’s plugin system lets you build fully custom functionality. Plugins extend BaseGridPlugin and can hook into lifecycle events, process rows/columns, handle keyboard events, and inject CSS.

For the full development guide including lifecycle hooks, plugin communication, the query system, and styling patterns, see Writing Custom Plugins.

Some plugin combinations conflict and should not be used together:

Plugin APlugin BReason
PinnedColumnsPluginGroupingColumnsPluginPinning reorders columns to edges, which breaks column group header layout
ResponsivePluginGroupingRowsPluginCard layout doesn’t support row grouping; variable row heights cause scroll issues
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt