BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/dnd-grid/multiple-instances-example

Multiple instances

dnd-grid/multiple-instances-example
FreeComponent

Run several independent grids on one page.

Install it

npx shadcn@latest add https://dnd-grid.com/r/multiple-instances-example.json

Source

examples/dnd-grid-multiple-instances-example.tsxdnd-grid.com/r/multiple-instances-example.json
1"use client";
2
3import { DndGrid, type Layout } from "@dnd-grid/react";
4import { useState } from "react";
5
6const initialLayoutA: Layout = [
7 { id: "a1", x: 0, y: 0, w: 3, h: 2 },
8 { id: "a2", x: 3, y: 0, w: 3, h: 2 },
9 { id: "a3", x: 6, y: 0, w: 3, h: 2 },
10];
11
12const initialLayoutB: Layout = [
13 { id: "b1", x: 0, y: 0, w: 4, h: 2 },
14 { id: "b2", x: 4, y: 0, w: 4, h: 2 },
15 { id: "b3", x: 8, y: 0, w: 4, h: 2 },
16];
17
18export function MultipleInstancesExample() {
19 const [layoutA, setLayoutA] = useState<Layout>(initialLayoutA);
20 const [layoutB, setLayoutB] = useState<Layout>(initialLayoutB);
21
22 return (
23 <div className="space-y-6">
24 <div>
25 <div className="mb-2 text-xs text-zinc-500">Grid A</div>
26 <DndGrid
27 cols={12}
28 layout={layoutA}
29 onLayoutChange={setLayoutA}
30 rowHeight={50}
31 >
32 {layoutA.map((item) => (
33 <div className="grid-item" key={item.id}>
34 {item.id}
35 </div>
36 ))}
37 </DndGrid>
38 </div>
39 <div>
40 <div className="mb-2 text-xs text-zinc-500">Grid B</div>
41 <DndGrid
42 cols={12}
43 layout={layoutB}
44 onLayoutChange={setLayoutB}
45 rowHeight={50}
46 >
47 {layoutB.map((item) => (
48 <div className="grid-item" key={item.id}>
49 {item.id}
50 </div>
51 ))}
52 </DndGrid>
53 </div>
54 </div>
55 );
56}

What it pulls in

npm packages

  • @dnd-grid/react
  • react-draggable
  • react-resizable

Files it writes

  • examples/dnd-grid-multiple-instances-example.tsx

Facts

Registry
dnd-grid
Type
registry:component
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
yesterday

Go to the source

dnd-grid.com mblode/dnd-grid on GitHub Raw registry item This item as JSON

More from dnd-grid

All 19 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Allow overlapallow-overlap-examplednd-gridComponentsFree3 deps
Aspect ratio constraintsaspect-ratio-constraints-examplednd-gridComponentsFree3 deps
Basic examplebasic-examplednd-gridComponentsFree3 deps
Boundedbounded-examplednd-gridComponentsFree3 deps
Compactor showcasecompactor-showcase-examplednd-gridComponentsFree3 deps
Compositioncomposition-examplednd-gridComponentsFree3 deps
Constraintsconstraints-examplednd-gridComponentsFree3 deps
Drag from outsidedrag-from-outside-examplednd-gridComponentsFree3 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex