Skip to content

Drag and drop

DnD

Drag control component.

jsx
import DnD from 'intergalactic/drag-and-drop';
<DnD />;
import DnD from 'intergalactic/drag-and-drop';
<DnD />;

DragAndDropProps

& {...}
NameTypeDescription
theme"dark" | "default"Deprecated
onSwapDraggable(draggableNode: React.ReactNode, droppableNode: React.ReactNode) => voidDeprecated
onInsertDroppable(draggableNode: React.ReactNode, droppableNode: React.ReactNode) => voidDeprecated
onDnD(dndData: {fromIndex: number; fromId: string; toIndex: number; toId: string }) => void Controlled drag and drop handler
customFocusnumber | string Index of id that indicates item that is currently under the user focus in case of real browser focus cannot be used. When provided, drag and drop listens to whole page keyboard events. Doesn't provide `onCustomFocusChange` callback.
localestring

DnD.Draggable

The element, which will be dragged.

jsx
import DnD from 'intergalactic/drag-and-drop';
<DnD>
  <DnD.Draggable />
</DnD>
import DnD from 'intergalactic/drag-and-drop';
<DnD>
  <DnD.Draggable />
</DnD>

DraggableProps

& {...}
NameTypeDescription
placement"top" | "right" | "bottom" | "left" | false Placement of visual drag-and-drop marker
noDropboolean Disabled DropZone abilities of component
idstring Used as `fromId` or `toId` in `onDnD` handler.
zoneNamestring Used for add zoneName in a11y hints

DnD.DropZone

The area, to which the dragged element will be placed.

jsx
import DnD from 'intergalactic/drag-and-drop';
<DnD>
  <DnD.DropZone />
</DnD>
import DnD from 'intergalactic/drag-and-drop';
<DnD>
  <DnD.DropZone />
</DnD>

DropZoneProps

& {...}
NameTypeDescription
zoneNamestring Used for add zoneName in a11y hints

Released under the MIT License.

Released under the MIT License.