Skip to content

Repository files navigation

Itemzen.GridStack.Blazor

Blazor wrapper for the gridstack.js library.

Credits go to the BlazorGridStack project, from which this wrapper took inspiration.

Installation

NuGet

dotnet add package Itemzen.GridStack.Blazor

The version of the nuget package matches the gridstack version against which the wrapper was created, including a version suffix indicating the wrapper release number. For example, v10.1.0-r2 indicates the second release of the wrapper for version 10.2.0 of the gridstack library.

Note that it is in general fine to use/include a different (minor) gridstack version in your project, especially bugfix releases, but if things don't work as expected it might be best to try and match the gridstack version exactly.

index.html

Download the gridstack files from npm

npm install --save gridstack

Copy the relevant files over from the node_modules/gridstack/dist to your Blazor project

wwwroot/lib/gridstack-all.js
wwwroot/lib/gridstack.min.css

Add the following lines in wwwroot/index.html

<head>
    ...
    <link href="lib/gridstack.min.css" rel="stylesheet" />
</head>
<body>
    ...
    <script src="lib/gridstack-all.js"></script>
</body>

Imports

Add a reference to the relevant namespace in the top-level _Imports.razor file of your project

@using GridStack.Blazor

Usage

The wrapper adds two components: GsGrid and GsWidget.

<GsGrid Options="...">
    <GsWidget Options="...">
        <div>The widget layout</div>
    </GsWidget>
</GsGrid>

The widgets can be added to the grid using markup (as shown above), or programatically using the GsGrid API.

The demo project contains additional details.

About

A Blazor wrapper for the gridstack.js library.

Resources

Stars

21 stars

Watchers

5 watching

Forks

Used by

Contributors

Languages