Swapy

A framework-agnostic drag-to-swap tool powered by Swapy. Convert any layout into an interactive drag-and-drop swap experience with just a few lines of code.

4.875

Project Views

last year

New Users

57K

+10%

We Build Future of

Design Industry

Team of passionate designers and developers

Daily New clients

54+40%

UI-Layouts

Font

SK-Modernist

Smart Digital

Agency For Your

Business

Trusted By

500+ Users

Don't Take Our Words For It...

Cards balance

$ 12,457

Card HolderExpires
Robert Fox07/22

Installation

npx uilayouts@latest add swapy

Structure

1
<SwapyLayout id='swapy'>
2
<SwapySlot id='slot-1'>
3
<SwapyItem id='item-1'>
4
<DragHandle />
5
Item 1
6
</SwapyItem>
7
<SwapyItem id='item-2'>
8
<DragHandle />
9
Item 2
10
</SwapyItem>
11
<SwapyItem id='item-3'>
12
<DragHandle />
13
Item 3
14
</SwapyItem>
15
</SwapySlot>
16
</SwapyLayout>

Props

SwapyLayout Props

PropsTypeDefaultDescription
idstringA unique identifier for the layout container.
enablebooleanWhether to enable drag-and-drop (currently unused in logic).
onSwap(event: { newSlotItemMap: { asArray: SlotItemMapArray } }) => voidCallback fired when an item is swapped.
configPartial<{ animation: "dynamic" | "spring" | "none"; continuousMode: boolean; manualSwap: boolean; swapMode: "hover" | "drop"; autoScrollOnDrag: boolean; }>{}Configuration object for swapy behavior.
classNamestringAdditional class names to apply to the layout container.
childrenReact.ReactNodeChild components (usually SwapySlots containing SwapyItems).

SwapyItem Props

PropTypeDefaultDescription
idstringUnique identifier for the draggable item.
classNamestringAdditional class names.
childrenReact.ReactNodeContent to render inside the draggable item.
dragItemOpacitynumber (10–100)100Tailwind opacity value applied when item is being dragged (e.g., 50 = 50%).

SwapySlot Props

PropTypeDefaultDescription
idstringUnique identifier for the slot (drop target).
classNamestringAdditional class names.
childrenReact.ReactNodeContent to render inside the slot.

DragHandle Props

PropTypeDefaultDescription
classNamestringOptional class names for the handle.

Examples

Handle

⚡ Turbocharge Everything

🧠 Brainy Decisions

🌈 Magical Moments

🚀 Innovate Like Crazy

💰 Save Big, Smile More

🔮 AI Vibes Only

Opacity

Streamline Operations

Decision Making

Customer Experiences

Accelerate Innovation

Reduce Costs

Future-Proof

Raws

A
B
C
D
E
F
G
H
I