Skip to content

Column Reorder Plugin

The Reorder plugin lets users rearrange columns by dragging and dropping column headers. Supports smooth FLIP animations, fade transitions, or instant reordering depending on your preference.

import '@toolbox-web/grid/features/reorder-columns';

Just enable the feature and columns become draggable. Users can grab any column header and drop it in a new position. Visual feedback and smooth animations are handled automatically.

import { queryGrid } from '@toolbox-web/grid';
const grid = queryGrid('tbw-grid');
grid.gridConfig = {
columns: [
{ field: 'id', header: 'ID' },
{ field: 'name', header: 'Name' },
{ field: 'email', header: 'Email' },
{ field: 'department', header: 'Department' },
],
features: {
reorderColumns: {
animation: 'flip',
animationDuration: 200,
},
},
};
// Listen for column moves
grid.on('column-move', ({ field, fromIndex, toIndex }) => {
console.log(`Moved ${field} from ${fromIndex} to ${toIndex}`);
});
Animation Reorder animation style
Duration (ms) Animation duration in ms

Drag column headers to reorder them. Use the controls below to experiment with different animation types and durations.

See ReorderConfig for the full list of options and defaults.

// No animation - instant reorder
features: { reorderColumns: { animation: false } }
// FLIP animation with custom duration
features: { reorderColumns: { animation: 'flip', animationDuration: 300 } }
// View Transitions API fade effect
features: { reorderColumns: { animation: 'fade' } }

Drag column headers to reorder them.

Event Log:
EventDetailCancelableDescription
column-move{ field, fromIndex, toIndex, columnOrder }YesFired when a column move is attempted. Call preventDefault() to block the move.
KeyAction
Alt + ←Move focused column left
Alt + →Move focused column right
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