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.
Draggable Drop Zones

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

The Draggable kit lets you customize the style of drop zones that appear when dragging an item.

By default, drop zones are in the "ghost" style, but you can also choose from "shadow," "outline," and "line."

When using the "line" type, make sure to set the appropriate direction attribute on the draggable/draggable_container component based on the orientation of your draggable view: "vertical" or "horizontal." Note that the direction attribute only applies to the "line" type and does not affect other drop zone styles. For more on the "line" style in particular, check out the Draggable Drop Zones Line doc example.

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 Drop Zones Line

211
212
213

211
212
213

When using the "line" style, make sure to set the appropriate direction attribute within the drop_zone_direction prop on the draggable/draggable_container component based on the orientation of your draggable view: "vertical" or "horizontal." Note that the direction attribute only applies to the "line" style and does not affect other drop zone styles. Also, set the drop_zone_line_color prop on the draggable/draggable_item component to "primary" or "purple".

The length of the line is calculated based off of the width (for "vertical") or height (for "horizontal") of the parent container holding the draggable items.

Additionally, if the parent container of the draggable/draggable/draggable_container (or a subcontainer within) does not have a set height (for "vertical") or width (for "horizontal"), like the Draggable Drop Zones doc example does, elements on the page may jump up (for "vertical") or to the left (for "horizontal") when an item is actively being dragged. To prevent this, give a parent element a fixed height (for "vertical") or width (for "horizontal") as demonstrated in this doc example.

Draggable Event Listeners

100
200
300

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

Dragging Across Multiple Containers

To Do
Terry Miles

Task 1

Bug fixes
Sophia Miles

Task 2

Documentation
Mike James

Task 4

Add jest tests
In Progress
Alice Jones

Task 3

Add a variant
Sally Jones

Task 6

Release
Done
James Guy

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.



Available Props

Props Type Values

align_content

enum | responsive
start
end
center
spaceBetween
spaceAround
spaceEvenly

align_items

enum | responsive
start
end
center

border_radius

enum
none
xs
sm
md
lg
xl
rounded

cursor

enum
auto
default
none
contextMenu
help
pointer
progress
wait
cell

dark

boolean
true
false

flex

enum | responsive
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none

flex_direction

enum | responsive
row
column
rowReverse
columnReverse

flex_wrap

enum | responsive
wrap
nowrap
wrapReverse

justify_content

enum | responsive
start
end
center
spaceBetween
spaceAround
spaceEvenly

line_height

enum
loosest
looser
loose
normal
tight
tighter
tightest

margin_right

array
none
xxs
xs
sm
md
lg
xl

margin_left

array
none
xxs
xs
sm
md
lg
xl

margin_top

array
none
xxs
xs
sm
md
lg
xl

margin_bottom

array
none
xxs
xs
sm
md
lg
xl

margin_x

array
none
xxs
xs
sm
md
lg
xl

margin_y

array
none
xxs
xs
sm
md
lg
xl

margin

array
none
xxs
xs
sm
md
lg
xl

width

string

min_width

string

max_width

string

gap

string | responsive

column_gap

string | responsive

row_gap

string | responsive

number_spacing

enum
tabular

order

enum | responsive
none
first
1
2
3
4
5
6
7
8
9
10
11
12

overflow_x

enum
scroll
visible
hidden
auto

overflow_y

enum
scroll
visible
hidden
auto

overflow

enum
scroll
visible
hidden
auto

padding_right

array
none
xxs
xs
sm
md
lg
xl

padding_left

array
none
xxs
xs
sm
md
lg
xl

padding_top

array
none
xxs
xs
sm
md
lg
xl

padding_bottom

array
none
xxs
xs
sm
md
lg
xl

padding_x

array
none
xxs
xs
sm
md
lg
xl

padding_y

array
none
xxs
xs
sm
md
lg
xl

padding

array
none
xxs
xs
sm
md
lg
xl

position

enum
relative
absolute
fixed
sticky
static

shadow

enum
none
deep
deeper
deepest

text_align

enum | responsive
start
end
left
right
center
justify
justifyAll
matchParent

truncate

enum
none
1
2
3
4
5

vertical_align

enum | responsive
baseline
super
top
middle
bottom
sub
text-top
text-bottom

z_index

enum | responsive
1
2
3
4
5
6
7
8
9
10
max

top

enum | object
xxs
xs
sm
md
lg
xl
xxl

inset

boolean
true
false

right

enum | object
xxs
xs
sm
md
lg
xl
xxl

bottom

enum | object
xxs
xs
sm
md
lg
xl
xxl

left

enum | object
xxs
xs
sm
md
lg
xl
xxl

height

string

max_height

string

min_height

string

hover

object

group_hover

boolean
true
false
Props Type Values Default

drop_zone

enum
ghost
outline
shadow
line

drop_zone_color

enum
primary
neutral
purple
neutral

initial_items

array

drop_zone_type

enum
ghost
shadow
outline
line
ghost