Static items
dnd-grid/static-elements-exampleFreeComponent
Static items cannot be moved or resized.
Install it
npx shadcn@latest add https://dnd-grid.com/r/static-elements-example.jsonSource
1"use client";23import { DndGrid, type Layout } from "@dnd-grid/react";4import { useState } from "react";56const initialLayout: Layout = [7 { id: "0", x: 0, y: 0, w: 3, h: 2, static: true },8 { id: "1", x: 3, y: 0, w: 3, h: 2 },9 { id: "2", x: 6, y: 0, w: 3, h: 2, static: true },10 { id: "3", x: 9, y: 0, w: 3, h: 2 },11];1213export function StaticElementsExample() {14 const [layout, setLayout] = useState<Layout>(initialLayout);1516 return (17 <DndGrid18 cols={12}19 layout={layout}20 onLayoutChange={setLayout}21 rowHeight={50}22 >23 {layout.map((item) => (24 <div25 className={item.static ? "static-item" : "grid-item"}26 key={item.id}27 >28 {item.id} {item.static ? "(static)" : ""}29 </div>30 ))}31 </DndGrid>32 );33}
What it pulls in
npm packages
Files it writes
More from dnd-grid
All 19 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Allow overlapallow-overlap-example | dnd-grid | Components | Free | 3 deps | |
| Aspect ratio constraintsaspect-ratio-constraints-example | dnd-grid | Components | Free | 3 deps | |
| Basic examplebasic-example | dnd-grid | Components | Free | 3 deps | |
| Boundedbounded-example | dnd-grid | Components | Free | 3 deps | |
| Compactor showcasecompactor-showcase-example | dnd-grid | Components | Free | 3 deps | |
| Compositioncomposition-example | dnd-grid | Components | Free | 3 deps | |
| Constraintsconstraints-example | dnd-grid | Components | Free | 3 deps | |
| Drag from outsidedrag-from-outside-example | dnd-grid | Components | Free | 3 deps |
