A basic Blazor component wrapper around Split Grid.
dotnet add package BlazorSplit
_Imports.razor
@using BlazorSplitGrid
index.html
or _Layout.cshtml/_Host.cshtml
depending on whether you're running WebAssembly or Server, it should be in the same location as the default blazor script.
<script src="https://github.com/Korthax/BlazorSplitGrid/raw/main/_content/BlazorSplitGrid/splitGrid/split-grid.min.js"></script>
<link href="https://github.com/Korthax/BlazorSplitGrid/blob/main/_content/BlazorSplitGrid/BlazorSplitGrid.min.css" rel="stylesheet" />
Blazor Split Grid will automatically generate the track number and classes for your gutters so all you need to specify is whether the gutter is a row or column.
<SplitGrid SnapOffset="0" DragInterval="1" MaxSize="850">
<SplitGridContent></SplitGridContent>
<SplitGridColumn />
<SplitGridContent></SplitGridContent>
<SplitGridRow />
<SplitGridContent></SplitGridContent>
<SplitGridContent></SplitGridContent>
</SplitGrid>
See the example project for a more comprehensive example.
You are able to specify all the Split Grid options on the top level SplitGrid
component except the row and column gutters.
Attribute | Type | Default | Description |
---|---|---|---|
MinSize | int | 0 | The minimum size in pixels for all tracks. |
MaxSize | int | Infinity | The maximum size in pixels for all tracks. |
ColumnMinSize | int | MinSize | The minimum size in pixels for all tracks. |
RowMinSize | int | MinSize | The minimum size in pixels for all tracks. |
ColumnMaxSize | int | MaxSize | The maximum size in pixels for all tracks. |
RowMaxSize | int | MaxSize | The maximum size in pixels for all tracks. |
ColumnMinSizes | Dictionary<int, int> | ColumnMinSize | An object keyed by track index, with values set to the minimum size in pixels for the track at that index. Allows individual minSizes to be specified by track. Note this option is plural with an s, while the two fallback options are singular. |
RowMinSizes | Dictionary<int, int> | RowMinSize | object keyed by track index, with values set to the minimum size in pixels for the track at that index. Allows individual minSizes to be specified by track. Note this option is plural with an s, while the two fallback options are singular. |
ColumnMaxSizes | Dictionary<int, int> | ColumnMaxSize | An object keyed by track index, with values set to the maximum size in pixels for the track at that index. Allows individual maxSizes to be specified by track. Note this option is plural with an s, while the two fallback options are singular. |
RowMaxSizes | Dictionary<int, int> | RowMaxSize | An object keyed by track index, with values set to the maximum size in pixels for the track at that index. Allows individual maxSizes to be specified by track. Note this option is plural with an s, while the two fallback options are singular. |
SnapOffset | int | 30 | Snap to minimum size at this offset in pixels. Set to 0 to disable snap. |
ColumnSnapOffset | int | SnapOffset | Snap to minimum size at this offset in pixels. Set to 0 to disable snap. |
RowSnapOffset | int | SnapOffset | Snap to minimum size at this offset in pixels. Set to 0 to disable snap. |
DragInterval | int | 1 | Drag this number of pixels at a time. Defaults to 1 for smooth dragging, but can be set to a pixel value to give more control over the resulting sizes. |
ColumnDragInterval | int | DragInterval | Drag this number of pixels at a time. Defaults to 1 for smooth dragging, but can be set to a pixel value to give more control over the resulting sizes. |
RowDragInterval | int | DragInterval | Drag this number of pixels at a time. Defaults to 1 for smooth dragging, but can be set to a pixel value to give more control over the resulting sizes. |
Cursor | string | 'col-resize' and 'row-resize' | Cursor to show while dragging. Defaults to 'col-resize' for column gutters and 'row-resize' for row gutters. |
ColumnCursor | string | 'col-resize' | Cursor to show while dragging. |
RowCursor | string | 'row-resize' | Cursor to show while dragging. |
OnDrag | DragEventArgs | - | Called continuously on drag. For process intensive code, add a debounce function to rate limit this callback. gridTemplateStyle is the computed CSS value for grid-template-column or grid-template-row, depending on direction. |
OnDragStart | DragEventArgs | - | Called on drag start. |
OnDragEnd | DragEventArgs | - | Called on drag end. |
You can specify the MinSize and MaxSize on the gutters which is automatically added to the ColumnMinSizes/RowMinSizes and ColumnMaxSizes/RowMaxSizes properties.
Attribute | Type | Default | Description |
---|---|---|---|
MinSize | int | 0 | The minimum size in pixels for this track. |
MaxSize | int | Infinity | The maximum size in pixels for this track. |
For more details check out our contributing guide.
When contributing please keep in mind the Code of Conduct.