You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-40Lines changed: 38 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,41 @@ positioning (relative, absolute, or static). Elements can also be moved between
32
32
If the item you are dragging already has a CSS Transform applied, it will be overwritten by `<Draggable>`. Use
33
33
an intermediate wrapper (`<Draggable><span>...</span></Draggable>`) in this case.
34
34
35
-
## Example
35
+
## API
36
+
The `<Draggable/>` component transparently adds draggable to whatever element is supplied as `this.props.children`.
37
+
**Note**: Only a single element is allowed or an Error will be thrown.
38
+
39
+
Props:
40
+
41
+
**`axis`**: determines which axis the draggable can move. Accepted values:
42
+
-`both` allows movement horizontally and vertically (default).
43
+
-`x` limits movement to horizontal axis.
44
+
-`y` limits movement to vertical axis.
45
+
46
+
**`handle`**: specifies a selector to be used as the handle that initiates drag.
47
+
48
+
**`cancel`**: specifies a selector to be used to prevent drag initialization.
49
+
50
+
**`grid`**: specifies the x and y that dragging should snap to.
51
+
52
+
**`bounds`**: specifies movement boundaries. Accepted values:
53
+
-`parent` restricts movement within the node's offsetParent (nearest node with position relative or absolute), or
54
+
- An object with `left, top, right, and bottom` properties. These indicate how far in each direction the draggable can be moved. See [example/index.html](https://github.com/mzabriskie/react-draggable/blob/master/example/index.html) for more on this.
55
+
56
+
**`start`**: specifies the `x` and `y` that the dragged item should start at. This is generally not necessary to use (you can use absolute or relative positioning of the child directly), but can be helpful for uniformity in your callbacks and with css transforms.
57
+
58
+
**`moveOnStartChange`**: if true (it defaults false), will move the element if there is a change in `start`. We set this by default to `false` because it can cause unwanted effects if you are not aware of it.
59
+
60
+
**`zIndex`**: specifies the zIndex to use while dragging.
0 commit comments