Playbook logo
14.18.0

Draggable

Default

1
2
3

The draggable kit gives you a full subcomponent structure that allows it to be used with almost any kit.

initial_items is a REQUIRED prop, which is the array of objects that contains data for the the draggable items.

draggable/draggable_container = This specifies the container within which items can be dropped.

draggable/draggable_item = This specifies the items that can be dragged and dropped. drag_id is a REQUIRED prop for draggable_item and must match the id on the items within initial_items.

Draggable with List Kit

  • Philadelphia
  • New Jersey
  • Maryland
  • Connecticut

For a simplified version of the Draggable API for the List kit, you can do the following:

The List kit is optimized to work with the draggable kit. To enable drag, use the enable_drag prop on List kit with an array of the included items AND drag_id prop on ListItems. You will also need to include the items prop containing your array of listed items for the Draggable API.

An additional optional boolean prop (set to true by default) of drag_handle is also available on ListItem kit to show the drag handle icon.

Draggable with SelectableList Kit


For a simplified version of the Draggable API for the SelectableList kit, you can do the following:

The SelectableList kit is optimized to work with the draggable kit. To enable drag, use the enable_drag prop on SelectableList kit AND drag_id prop within the SelectableList kit prop. An additional optional boolean prop (set to true by default) of drag_handle is also available on SelectableList kit to show the drag handle icon.

Draggable with Cards

Joe Black

35-12345
8:00A • Township Name • 90210
Schedule QA
Flex
R99

Nancy White

35-12345
8:00A • Township Name • 90210
Schedule QA
Flex
R99

Bill Green

35-12345
8:00A • Township Name • 90210
Schedule QA
Flex
R99

For a simplified version of the Draggable API for the Card kit, you can do the following:

Use the draggable kit and manage state as shown.

draggable/draggable_container kit creates the container within which the cards can be dragged and dropped.

The Card kit is optimized to work with the draggable kit. To enable drag, use the draggable_item and drag_id props on the Card kit as shown. An additional optional boolean prop (set to true by default) of drag_handle is also available to show the drag handle icon.

Draggable with Table

id name task number
1
Terry Miles
Task 1
2
Sophia Miles
Task 2
3
Alice Jones
Task 3
4
Mike James
Task 4
5
James Guy
Task 5

The draggable kit can also be used in conjunction with the table kit to create draggable table rows. To do this:

  • use the draggable_container prop on the table/table_body to designate it as the Draggable Container
  • use the draggable_item prop on the table/table_row to designate it as the Draggable Item. Make sure to also pass id to the drag_id prop here.
Dragging Across Multiple Containers

To Do

Task 1

Bug fixes

Task 2

Documentation

Task 4

Add jest tests
In Progress

Task 3

Add a variant

Task 6

Release
Done

Task 5

Alpha testing

The Draggable kit can also be used to achieve more complex, multiple container functionality as shown here. This complex usage requires the full subcomponent structure.

Draggable Drop Zones

Shadow
Task 1
Task 2
Task 3
Outline
Task 1
Task 2
Task 3

Draggable Drop Zones Colors

141
142
143

141
142
143

The default color for Draggable kit drop zones is "neutral", with "primary" or "purple" as additional options.

Draggable Event Listeners

100
200
300

You can add drag event listeners for drag, dragend, dragenter, dragleave, dragover, dragstart, and drop.



Available Props

Props Type Values Default

initial_items

array

drop_zone_type

enum
ghost
shadow
outline
line
ghost

drop_zone_color

enum
neutral
primary
purple
neutral