# @libria/gridstack

> Angular 8 wrapper for gridstack.js

Latest version **9.0.1** (published 2020-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @libria/gridstack
pnpm add @libria/gridstack
yarn add @libria/gridstack
bun add @libria/gridstack
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 9.0.1 |
| Published | 2020-04-23 |
| First published | 2018-01-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 1016.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Maintainers | pfms84 |

## Links

- npm: https://www.npmjs.com/package/@libria/gridstack
- Repository: https://github.com/pfms84/lb-gridstack
- Homepage: https://github.com/pfms84/lb-gridstack#readme
- Issues: https://github.com/pfms84/lb-gridstack/issues
- npm.io page: https://npm.io/package/@libria/gridstack

## Recent versions

- 9.0.1 (latest) — 2020-04-23
- 9.0.0 — 2020-04-20
- 8.0.1 — 2019-11-07
- 8.0.0 — 2019-11-07
- 6.0.1 — 2018-08-14
- 0.0.3 — 2018-01-31
- 0.0.2 — 2018-01-31
- 0.0.1 — 2018-01-31

## README

# lb-gridstack

Angular 9 wrapper for [Gridstack.js](http://gridstackjs.com/).

## Getting started

```bash
npm install @libria/gridstack --save
```

Then import the library on your root module (AppModule, for instance):
```bash
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';


import { AppComponent } from './app.component';
import { GridstackModule } from '@libria/gridstack';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    GridstackModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
```

Since this library is a wrapper for a jquery plugin, you need to define some global plugins and styles.

### Using Angular-cli:
- Add the following to the .angular.json file
```bash
{
  ...,
  "apps": [{
    ...
    "styles": [
        "../node_modules/gridstack/dist/gridstack.css",
        ...
    ],
    "scripts": [
        "../node_modules/lodash/lodash.min.js",
        "../node_modules/jquery/dist/jquery.min.js",
        "../node_modules/jquery-ui-dist/jquery-ui.js",
        "../node_modules/gridstack/dist/gridstack.js",
        "../node_modules/gridstack/dist/gridstack.jQueryUI.js",
        ...
    ],
  }]
}
```

## Basic library usage

```bash
<div lb-gridstack
     width="5">
    <div lb-gridstack-item
         x="0"
         y="0"
         width="3">
        Widget 1
    </div>
    <div lb-gridstack-item
         x="3"
         y="0"
         width="2">
        Widget 2
    </div>
</div>
```

## Options
_All attribute options match the gridstack.js data-gs-* attributes unless explicitly stated._
### lb-gridstack

| Name | Description | Additional Information |
| --- | --- | --- |
| options | general options for the grid. See <https://github.com/gridstack/gridstack.js/tree/master/doc#options> | The option 'acceptWidgets' is not fully supported yet |
| animate | turns animation on | - |
| width | amount of columns | The library supports up to 24 columns without having to manually change the CSS |
| height | maximum rows amount | - |

### lb-gridstack-item
| Name | Description | Additional Information |
| --- | --- | --- |
| id | good for quick identification | - |
| x | element position | - |
| y | element position | - |
| width | element size | - |
| height | element size | - |
| max-width | element size constraint | - |
| max-height | element size constraint | - |
| min-width | element size constraint | - |
| min-height | element size constraint | - |
| no-resize | disable element resizing | - |
| no-move | disable element moving | - |
| auto-position | tells to ignore data-gs-x and data-gs-y attributes and to place element to the first available position | - |
| locked | the widget will be locked. It means another widget wouldn't be able to move it during dragging or resizing. The widget can still be dragged or resized. You need to add data-gs-no-resize and data-gs-no-move attributes to completely lock the widget. | - |

---
_Source: https://npm.io/package/@libria/gridstack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
