Optional
acceptAccept widgets dragged from other grids or from outside (default: false
). Can be:
true
: will accept HTML elements having 'grid-stack-item' as class attributefalse
: will not accept any external widgets// Accept all grid items
acceptWidgets: true
// Accept only items with specific class
acceptWidgets: 'my-draggable-item'
// Custom validation function
acceptWidgets: (el) => {
return el.getAttribute('data-accept') === 'true';
}
http://gridstack.github.io/gridstack.js/demo/two.html for complete example
Optional
alwayspossible values (default: mobile
) - does not apply to non-resizable widgets
false
the resizing handles are only shown while hovering over a widget
true
the resizing handles are always shown
'mobile' if running on a mobile device, default to true
(since there is no hovering per say), else false
.
See example
Optional
animateturns animation on (default?: true)
Optional
autoif false gridstack will not initialize existing items (default?: true)
Optional
cellOne cell height (default: 'auto'). Can be:
Note: % values don't work correctly - see demo/cell-height.html
Optional
cellthrottle time delay (in ms) used when cellHeight='auto' to improve performance vs usability (default?: 100). A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event!
Optional
cell(internal) unit for cellHeight (default? 'px') which is set when a string cellHeight with a unit is passed (ex: '10rem')
Optional
childrenlist of children item to create when calling load() or addGrid()
Optional
classadditional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance. Note: only used by addGrid(), else your element should have the needed class
Optional
columnnumber of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns. Note: for nested grids, it is recommended to use 'auto' which will always match the container grid-item current width (in column) to keep inside and outside items always the same. flag is NOT supported for regular non-nested grids.
Optional
columnresponsive column layout for width:column behavior
Optional
disabledisallows dragging of widgets (default?: false)
Optional
disabledisallows resizing of widgets (default?: false).
Optional
draggableallows to override UI draggable options. (default?: { handle?: '.grid-stack-item-content', appendTo?: 'body' })
Optional
enginethe type of engine to create (so you can subclass) default to GridStackEngine
Optional
floatenable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html)
Optional
handledraggable handle selector (default?: '.grid-stack-item-content')
Optional
handledraggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null)
Optional
itemadditional widget class (default?: 'grid-stack-item')
Optional
layoutre-layout mode when we're a subgrid and we are being resized. default to 'list'
Optional
lazytrue when widgets are only created when they scroll into view (visible)
Optional
margingap between grid item and content (default?: 10). This will set all 4 sides and support the CSS formats below an integer (px) a string with possible units (ex: '2em', '20px', '2rem') string with space separated values (ex: '5px 10px 0 20px' for all 4 sides, or '5em 10em' for top/bottom and left/right pairs like CSS). Note: all sides must have same units (last one wins, default px)
Optional
marginOptional
marginOptional
marginOptional
marginOLD way to optionally set each side - use margin: '5px 10px 0 20px' instead. Used internally to store each side.
Optional
margin(internal) unit for margin (default? 'px') set when margin
is set as string with unit (ex: 2rem')
Optional
maxmaximum rows amount. Default? is 0 which means no maximum rows
Optional
minminimum rows amount which is handy to prevent grid from collapsing when empty. Default is 0
.
When no set the min-height
CSS attribute on the grid div (in pixels) can be used, which will round to the closest row.
Optional
nonceIf you are using a nonce-based Content Security Policy, pass your nonce here and GridStack will add it to the
Defines the options for a Grid