Widget Grid

Draggable and resizable widget layout on a CSS grid with keyboard edit affordances.

Also known as: dashboard grid, tile grid, resizable widgets

Installation

Install with the CLI, or copy the component source into your project.

Add widget-grid (npm)

npx --yes -p github:itsvigneshv/default-file-ui#main df-ui add widget-grid

Properties

Draggable and resizable widget layout on a CSS grid with keyboard edit affordances.

WidgetGrid

PropTypeDefaultNotes
layoutWidgetLayoutItem[]-Controlled cell placements (required).
onLayoutChange(layout: WidgetLayoutItem[]) => void-Called after a move or resize commits.
renderWidget(id: string) => ReactNode-Render function for each layout id (required).
columnsnumber12Column count for the grid.
editablebooleantrueWhen false, drag, resize, and keyboard edit affordances are disabled.
minRowHeightstring-CSS length override for --df-widget-grid-row-height on this instance.
emptyContentReactNode-Content when the layout array is empty.
aria-labelstring-Accessible name for the grid. Defaults to the kit string catalogue. Override when the host supplies a visible heading.
classNamestring-Additional styles on the root.

WidgetLayoutItem

PropTypeDefaultNotes
idstring-Stable widget id (required).
xnumber-Column index from the left (required).
ynumber-Row index from the top (required).
wnumber-Width in columns (required).
hnumber-Height in rows (required).
minWnumber-Minimum width in columns.
minHnumber-Minimum height in rows.
maxWnumber-Maximum width in columns.
maxHnumber-Maximum height in rows.

Accessibility

Grid name: Pass aria-label when a visible title is not enough; otherwise the catalogue default names the grid. Widget content: renderWidget must supply meaningful content and names inside each cell. Drag handles: Editable cells expose move and resize controls with catalogue labels. Live region: Keyboard edits announce the new cell position and size.