gridstack /gridstack.js
Build interactive dashboards in minutes.
★ 9,244⑂ 1,419👁 170⑃ 1,832● 1,625▤ 139
+0
Daily
9,244
stars
1,419
forks
170
watchers
1,832
prs
1,625
issues
139
releases
README
gridstack.js
Mobile-friendly modern pure Typescript library (no external dependencies) for dashboard layout and creation. Making a drag-and-drop, multi-column responsive dashboard has never been easier. Has multiple bindings and works great with Angular (included), React (included), Vue (included), Knockout.js, Ember and others (see frameworks section).
Inspired by no-longer maintained gridster, built with love.
Check http://gridstackjs.com and these demos.
If you find this lib useful, please donate PayPal (use “send to a friend” to avoid 3% fee) or Venmo (adumesny) and help support it!
Join us on Slack: https://gridstackjs.slack.com
Table of Contents generated with DocToc
- Demo and API Documentation
- Usage
- Install
- Include
- Basic usage
- Requirements
- Specific frameworks
- Extend Library
- Extend Engine
- Change grid columns
- Custom columns CSS (OLD, not needed with v12+)
- Override resizable/draggable options
- Touch devices support
- Printing Support
- Migrating
- Migrating to v0.6
- Migrating to v1
- Migrating to v2
- Migrating to v3
- Migrating to v4
- Migrating to v5
- Migrating to v6
- Migrating to v7
- Migrating to v8
- Migrating to v9
- Migrating to v10
- Migrating to v11
- Migrating to v12
- Migrating to v13
- Migrating to v14
- jQuery Application
- Changes
- Usage Trend
- The Team
Demo and API Documentation
Please visit http://gridstackjs.com and these demos. Complete API documentation: HTML for the latest release, or markdown for this branch (regenerated with the code, so it also covers unreleased changes).
Usage
Install
js
yarn add gridstack
// or
npm install --save gridstack
Include
ES6 or Typescript
js
import 'gridstack/dist/gridstack.min.css';
import { GridStack } from 'gridstack';
Alternatively (single combined file, notice the -all.js) in html
html
Note: IE support was dropped in v2, but restored in v4.4 by an external contributor (I have no interest in testing+supporting obsolete browser so this likely will break again in the future) and DROPPED again in v12 (css variable needed).
You can use the es5 files and polyfill (larger) for older browser instead. For example:
html
Basic usage
creating items dynamically...
js
// ...in your HTML
// ...in your script
var grid = GridStack.init();
grid.addWidget({w: 2, content: 'item 1'});
... or creating from list
js
// using serialize data instead of .addWidget()
const serializedData = [
{x: 0, y: 0, w: 2, h: 2},
{x: 2, y: 3, w: 3, content: 'item 2'},
{x: 1, y: 3}
];
grid.load(serializedData);
... or DOM created items
js
// ...in your HTML
Item 1
Item 2 wider
// ...in your script
GridStack.init();
...or see list of all API and options available.
see stackblitz sample as running example too.
Requirements
GridStack no longer requires external dependencies as of v1 (lodash was removed in v0.5 and jquery API in v1). v3 is a complete HTML5 Top issues
#2554How to define sub-grid in HTML and initialize it later in JS5 comments · 2023-11-28#3198Its difficult for drop the widgets inside subgrid if its height is smaller than widget3 comments · 2025-11-29#3192Items placed wrong after resizing when using columnOpts.breakpoints2 comments · 2025-11-17#2761Looking for an event for when a widget is dragged from the toolbar and onto the grid (when the placeholders are placed).2 comments · 2024-08-29#3359Svelte wrapper1 comments · 2026-08-18#3306Revert animation is no longer available after migrating from GridStack v3 to v121 comments · 2026-07-15#2945Flickering Scrollbar1 comments · 2025-02-14#2933Node is deleted when hovering with node over other grid (after acceptWidget called) and pressing escape1 comments · 2025-01-22
Latest release
v14.1.0 v14.1.0 2026-11-04feat: 3451, 3452 dragging between grids now goes by how much of the item is over a grid (like jquery-ui's intersect before v6) rather than where the cursor is. Also make it possible to insert above a nested grid even when parent grid overlapps exactly. feat: 3356 auto-scroll triggers off the cursor nearing an edge (not just widget being clipped) fix: 3355 auto-scroll hands off to the outer container when a nested scroll container is pinned fix: 2729 cancel selector now matches elements inside a shadow root fix: 2728 drag helper drifts off the cursor when the page scrolls under a CSS-tr