Draggable
A component that makes its element a drag source.
Draggable makes an element draggable with the pointer or keyboard. It pairs with DropTarget, which defines where a drag can be released. See the drag and drop overview for examples and the styling guide for drag states.
Anatomy
Import the component and assemble its parts:
A root takes at most one preview part. Omit it to use a sanitized clone of the
source, render Draggable.ClonedPreview to configure that clone, or use
Draggable.Preview to render custom content. Declaring both warns in development;
the last one mounted wins. Draggable.Displacement is independent and opts the
root into reorder animations.
Pass data along
Every draggable is of a kind, declared once with Draggable.createKind and passed to both sides of the drag. Drop targets list the kinds they take in their accept, and the payload type the kind was created with is what a drop handler receives as source.payload:
A kind with a payload type makes payload required, so a target is never handed undefined where the kind promised data. Skip the type argument for an item that is only a marker, and payload becomes optional:
Pass getPayload instead when the payload depends on the gesture, such as where inside the element the pointer grabbed. It runs once, at drag start. payload itself is always data, so function-valued payloads are preserved without a wrapper.
Drag handle
By default, the whole element is draggable. Render a Draggable.Handle inside the root to start drags from a handle while the rest of the card stays interactive. If a draggable has several handles, only the first starts the drag.
When the root has a label and the handle renders no text, the handle uses Drag {label} as its accessible name. A handle with visible text keeps that text as its accessible name. This lets speech-input users activate it by saying the words they see. If the handle needs a longer name, add an aria-label that starts with the visible text. Base UI cannot detect visible text returned by a render function or custom component. Add an explicit aria-label or aria-labelledby when such a handle contains only an icon.
Keyboard-only handle
Use Draggable.KeyboardHandle when the whole source should remain draggable with the pointer, but keyboard dragging should start only from a dedicated button. Space and Enter pick the source up while this button has focus. Activating the button with assistive technology starts the same keyboard drag.
The root stays out of the tab order while the keyboard handle is mounted. Pointer dragging still starts anywhere on the root, including over the handle.
Conditional drag
Pass disabled to stop an item from being picked up with the pointer or keyboard. Clicks and context-menu presses keep their normal behavior, and screen readers no longer receive keyboard-drag instructions. You can change the prop at runtime without re-registering the draggable.
When the decision needs the gesture itself, such as which handle was pressed or whether a modifier key is down, use onBeforeDragStart instead. It fires once the drag is about to start, before anything lifts, and calling eventDetails.cancel() prevents it:
Drag events
The optional event handlers below fire in order. All except onBeforeDragStart receive the drag source, location history, and mode, which is either 'pointer' or 'keyboard'.
Every handler receives the event payload first. Its second argument, eventDetails, contains the event reason and native event.
Use useDragMonitor to observe every drag on the page instead of one source.
These handlers reuse the native drag event names, so the native HTML drag event props are omitted. As a result, ComponentPropsWithoutRef<'div'> cannot be spread onto Draggable.Root. A wrapper component should declare the element props it forwards instead of exposing every DOM prop:
The native events stay reachable through the render prop, which merges its props onto the rendered element untouched.
Re-rendering the source mid-drag
A drag continues if its source element leaves the DOM. For example, a virtualized list can unmount the dragged row after it scrolls out of view. The drag still moves and drops normally, so the list does not need to keep the row mounted. The same applies when an item is rendered in a different container.
source.element follows a replacement DOM node rendered by the same Draggable.Root instance, such as a virtualizer recycling the row in place. After a complete unmount with no surviving root instance, it remains the last registered node. Read source.payload when you need to identify what is being dragged; if you specifically need stable pickup-node identity, capture source.element in onDragStart:
Deleting the dragged item does not end the drag either. Call cancelDrag if you want it to stop:
Animating displaced items
Render Draggable.Displacement inside each root that should animate after a reorder. It renders nothing and publishes the offset from the item’s previous position as --drag-displacement-x and --drag-displacement-y. It also adds data-starting-style for the first frame and keeps data-displacing while the animation runs. A synchronous update from onDragEnd is animated after a drop or cancellation. A deferred update is not.
Define the animation with two CSS rules:
Do not apply the transition during the data-starting-style frame. This lets an interrupted reorder continue from its current position. Use translate so the displacement composes with an existing transform, and repeat any other transitions replaced by the shorthand. Disable both rules for users who prefer reduced motion. The starting-style rule alone displays the previous position for one frame.
Base UI measures only items in the viewport. Items outside it move to their new position without an animation, so mounted offscreen items do not add layout measurements. An item scrolled into view during a drag uses its current position as the animation start point.
Activation
A pointer press doesn’t start a drag right away. The item is picked up once the gesture reads as a drag rather than a click or a scroll. Mouse and pen activate after the pointer moves 5px; touch activates after a 250ms press-hold, with a 5px movement tolerance, so that scrolling a list still scrolls it. Anything short of that stays a plain click or tap and reaches the element underneath.
The item lifts off exactly where it sat, so the wait never shows up as a jump.
Pass pointerActivation to change the thresholds. It takes a single DragActivation applied to every pointer type, or a map keyed by 'mouse', 'touch', and 'pen', where unlisted types keep their defaults. A DragActivation is one of { type: 'immediate' }, { type: 'distance', distance }, or { type: 'press-hold', delay, tolerance? }.
Use { type: 'immediate' } to pick the item up on the first pointerdown, with no travel. This is a good fit for a canvas where the whole tile is a drag affordance. Avoid it when the item contains buttons or links: a click on them would start a drag instead.
Keyboard navigation
Draggable.Root is focusable by default and supports keyboard dragging. Focus a source and use these keys:
- Space or Enter picks the item up.
- Arrow keys move it toward the nearest drop target in the pressed direction. With no target that way, the item nudges by a fixed step instead (hold Shift for a coarser one), so free-form dragging still works.
- Space or Enter drops it; Escape or Tab cancels.
The widgets above use plain draggables and drop targets with no keyboard-specific code. Each slot has a label so announcements can name it. Pressing ← or → moves the focused widget to the next accepting slot in that direction. The same behavior applies to any draggable and drop target, including reorderable collections.
The source must be focusable. When keyboard dragging is enabled without a Draggable.Handle, Draggable.Root defaults to tabIndex={0} and role="button". A handle renders its own focusable button. Pass tabIndex or role to override either default. Override the role if the element already has semantics such as listitem or row. Prefer a handle when the source contains interactive children because a button cannot contain other interactive elements. When using registerDraggable, make the registered element focusable.
The default tabIndex and role are added after mount, once the root knows whether it has a handle. Pass them explicitly when a server-rendered draggable must be keyboard-reachable before hydration.
Screen-reader announcements
Pickup, drop, and cancel are announced automatically. The default announcement uses the item’s label, for example, “Grabbed Water the plants…", followed by the keyboard instructions. Without a label, it uses “item”. Add a label to each DropTarget.Root to announce the destination. For example, moving over a target announces “Water the plants on Done”, and dropping announces “Dropped Water the plants on Done.” Moves over an unlabeled target are silent, and its drop announcement omits the destination.
Pass keyboardAnnouncements.moved (and any of pickedUp, dropped, canceled) to narrate moves yourself. Each callback returns the string to announce, or null to stay silent:
For localized strings across every draggable, provide them through LocalizationProvider instead of per-source. Two more per-source options tune what assistive tech reads: ariaRoleDescription sets the handle’s aria-roledescription (a localized “draggable” by default), and keyboardInstructions replaces the instructions announced when the handle is focused.
Controlling movement
By default, an arrow key moves to the nearest drop target or by a fixed step when no target is ahead. Use keyboardMovement when the component has its own movement rules. The callback receives the pressed key, drag context, default suggestion, and the findTarget and getTargets helpers. Its return value controls the move:
{ x, y }moves the cursor to those client coordinates, clamped to the viewport. Base UI does not apply an extra Shift multiplier.- An
Elementscrolls into view and becomes the destination. Use this to reach an element outside the viewport. - The
suggestionaccepts the default move, with an optional adjustedposition. Returning{ type: 'target', element, position }moves onto an element while preserving a coordinate, such as the same height in the adjacent column. falsehandles the key without moving.nullorundefineduses the default behavior for that key.
In a sortable list or a board, free space is never a valid position, so the step-nudge fallback only lets the preview drift into dead space. Draggable.targetsOnlyKeyboardMovement is a prebuilt resolver for exactly that: arrows only ever move between accepting drop targets, and a press past the last one does nothing. The sortable list demo uses it.
On a free-form canvas, every point is valid. Moving to the nearest target could send the source across the canvas unexpectedly. Draggable.fixedStepKeyboardMovement(step) instead moves by step without checking targets. Holding Shift moves four times as far.
The step is in the source’s own coordinate space, so a zoomable canvas moves the source the same distance on the board at any zoom. Write your own resolver when the step depends on more than direction:
For a grid with custom movement rules, see the calendar example. Vertical movement changes the time, while horizontal movement changes the day. Return false to refuse a key press and call keyboardAnnouncements.reachedEdge, which is silent by default. Return null or undefined to use the default movement.
Restoring focus
When a keyboard drag ends, Base UI tries to focus the handle, source, and then innermost drop target. Pointer drags never move focus. Use finalFocus to choose another element. Pass false to leave focus unchanged, a ref, or a function that returns the element to focus. From the function, return true or null for the default behavior. Return false or undefined to leave focus unchanged.
Moving the pickup elsewhere
Space picks up a draggable, but many elements already use that key. A calendar event may open a menu, Space may select a listbox option, or a card may expand. One key press cannot perform both actions.
Set keyboardActivation="manual" to keep Space and Enter for the element. Start the drag from the appropriate control by calling useDragDropManager().startKeyboardDrag(element). Announcements and focus restoration work the same as for an automatically started keyboard drag.
The element stays focusable and is still announced as draggable. Because Base UI does not know which control starts the drag, it omits the default “press Space to lift” instructions. Use keyboardInstructions to describe how to start the drag.
Each widget above is a menu trigger, so Space opens the menu and Move starts the drag. Then ← and → choose an empty dashboard slot, and Space drops the widget.
- Show Move only when the menu was opened with the keyboard. Pointer users can drag the widget directly.
- Start the drag from
onOpenChangeCompleteafter the menu closes, not from the item’sonClick. Closing the menu returns focus to its trigger before the drag starts.
Pass keyboardActivation="off" to disable keyboard dragging. The element stays pointer-draggable. Base UI leaves every key to your handlers and omits the keyboard-drag instructions, tabIndex, and role defaults. Use this only when another control provides the same keyboard action, or when the draggable is aria-hidden decoration such as a resize handle.
Movement modifiers
A drag follows the pointer freely by default. Pass modifiers to keep it on one axis, snap it to a grid, or hold it inside an element. The same modifiers apply to pointer and keyboard drags. They constrain the preview, drop hit test, and keyboard cursor.
The prebuilt modifiers:
restrictToVerticalAxisandrestrictToHorizontalAxislock the drag to one axis, anchored where it began.restrictToParentElementkeeps it inside the source’s parent, andrestrictToElement(target)inside any element, ref, or function returning one.restrictToWindowEdgeskeeps it inside the viewport.snapToGrid(size)snaps to a grid anchored at the pickup point. Pass a number or{ x, y }for a rectangular grid. The step uses the source’s coordinate system. For example,snapToGrid(20)still snaps to a 20-unit grid when the canvas is zoomed to 70%.
Pass an array to combine them, each clamping the previous one’s result.
Below, restrictToElement clamps each widget to the dashed dashboard frame. The preview and drop hit test cannot leave the frame, so the outside slot never activates. Write a custom modifier for behavior the presets do not cover, such as snapping to calendar slots. See Write your own and the calendar example.
Modifiers on the preview
Draggable.Preview and Draggable.ClonedPreview take the same modifiers prop. These modifiers affect only the preview. The drop hit test, keyboard movement, and reported input remain unconstrained. Use preview modifiers when leaving an area must still cancel the drag. For example, a data grid can keep the preview inside the grid while allowing a release outside it to cancel instead of dropping on the nearest header. Otherwise, put the modifier on Draggable.Root so the preview position matches the drop position.
Write your own
A modifier takes the point the engine would use and returns the point to use instead. Alongside point, it receives where the drag began (initialPoint), the cursor (input), the source and preview rects, scale, and the modifier keys held by the event that produced the move. It runs on every frame of a pointer drag and on every keyboard press, so keep it cheap.
Points use client pixels, which match measurements from the viewport or another element’s bounding rect. To work in a zoomable canvas’s coordinate system, multiply distances by scale. The value includes CSS transform and zoom scaling applied to the source or its ancestors. It is 1 when the source is not scaled. A rotation alone does not change it. The snapToGrid preset uses this value.
Gating on a modifier key
ctrlKey, shiftKey, altKey, and metaKey report the keys held for the event that produced the move. For example, a drawing tool can bind “snap to 45°” to Shift. During a pointer drag, pressing or releasing a modifier key reapplies the modifiers on the next frame. During a keyboard drag, these fields report the keys held for each arrow press. Ctrl, Alt, and Meta chords remain available for other shortcuts.
Check mode with the modifier keys. The same key can behave differently for pointer and keyboard drags. For example, Shift increases the step for fixedStepKeyboardMovement, so a pointer-only Shift modifier should also require mode === 'pointer'.
A modifier only moves a point, so it still can’t express a keyboard move that targets a specific element or refuses the press. Use keyboardMovement for those.
Drag previews
Default preview
With no preview part, a sanitized clone of the dragged element follows the pointer. The clone keeps your element’s classes and live form, canvas, and scroll state, and renders in the browser’s top layer, where no scroll container can clip it and nothing on the page paints over it.
The clone rewrites its IDs to keep the document unique and updates fragment references inside the clone. External #id selectors therefore do not style it; use classes or [data-drag-preview] for preview styles.
Custom elements inside a clone are replaced with inert native placeholders. Cloning a live custom element would run its constructor and connection callbacks again merely because a drag started. Render a Draggable.Preview when the preview must reproduce a custom element’s shadow content exactly.
Base UI reads the computed style of each custom element to size and style its inert placeholder. For a draggable containing many custom elements, use a lightweight Draggable.Preview to avoid doing that work when the drag starts.
After a release, the clone moves to the source’s final position and receives data-ending-style. That includes a release outside a target, when it returns to the unchanged source. Add a translate transition under that attribute to animate the handoff; the engine keeps the clone mounted until the transition finishes. The source also receives data-ending-style alongside data-dragging, so it can remain styled as an empty placeholder until the clone arrives. With no transition, the attributes and clone are removed before the next paint.
Cloning cannot reproduce every browser state. Render a Draggable.Preview in these cases:
- Content drawn outside the DOM: a WebGL
<canvas>, a playing<video>, an element’s shadow DOM. Form values, canvas drawings and scroll positions are carried over. :hover,:focusand:focus-withindon’t apply to the preview, so styles that depend on them render in their resting state.- A bare native control, such as an unstyled
<button>or<input>, loses its default browser chrome in the top layer. Give it your own styles, or use aDraggable.Preview.
Custom previews
To show something other than a clone, render a Draggable.Preview inside the root. Its children become the preview. Like the clone, it is placed next to the element it was lifted from, so your CSS reaches it the same way.
Keep pointer-events: none on the preview and its children. Base UI sets it on the preview element so hit testing reaches the drop targets underneath. If a child overrides it with pointer-events: auto, Base UI must hide the preview and repeat the hit test on every drag frame.
The dashboard below drags each widget as a compact badge instead of a copy of itself.
The content renders beside the nearest Draggable.PreviewProvider‘s children and outlives the source when a virtualizer or a live reorder unmounts it mid-drag. It receives context from providers above that preview provider, but not from providers nested between the preview provider and this draggable. Place a preview provider inside each local theme, direction, or store boundary the preview needs. The element itself still sits next to the source, so your CSS reaches it either way.
Pass a function as the children to build the preview from the dragged item’s data. To match the source size, use the --drag-source-width and --drag-source-height CSS variables. See Sizing a custom preview.
To show no preview for a particular drag, resolve the children to nothing: null, or a falsy {condition && …}. The engine tears down the host it had already built, so nothing follows the pointer for that drag. To switch the preview off for good, see Drag without a preview.
Configure the clone
To configure how the default clone is placed, render a Draggable.ClonedPreview. It takes the same placement props as Draggable.Preview and renders nothing, since the clone is the engine’s and there’s no content to own:
You only need this part to configure the clone. Style the clone with [data-drag-preview]. The part renders no element of its own, so it takes no className.
Drag without a preview
Use disabled on a preview part when nothing should follow the pointer. The drag still runs, so targets receive drag state and the drop can complete. This is useful for a canvas that draws its own drag feedback. Draggable.ClonedPreview needs no preview provider, even when disabled.
Position the preview
Use offset to place the preview relative to the pointer. It defaults to 'source', which keeps the exact grab point the element was picked up by, so the preview lifts off without shifting.
offset works the same on Draggable.Preview and Draggable.ClonedPreview.
A Draggable.Preview with no children resolves to no preview at all, so give it
content. Use Draggable.ClonedPreview, as shown here, to position the clone.
Render previews elsewhere
Previews render as the last of the source’s siblings, so for the duration of the drag an extra element sits in the list. Two things notice:
- Selectors that count from the end of the list shift, so
:last-child,:only-child, and:nth-last-childrules on siblings can flicker. The:nth-childselector is unaffected because it counts from the start. - DOM scans see it. If you
querySelectorAllthe siblings to work out where a drop lands, filter the preview out:Skip the preview when scanning
To avoid both, pass container to inject the preview elsewhere. It accepts an element, a ref, or a callback that resolves the container from the source. The callback is useful when the item has no ref:
Set it on Draggable.PreviewProvider to apply to every source inside it, with no per-item prop. A preview’s own container wins over that:
Prefer the closest suitable container. The preview no longer has the source’s ancestors, so selectors such as .Column .Card stop matching. A nearby themed wrapper preserves more of the cascade than a container near the document root. Rules based on the preview’s own classes still apply. Its DOM container does not affect React context.
Set the drag cursor
While a pointer drag is in progress the cursor is pinned to grabbing across the whole document, so it stays consistent no matter what is under the pointer. Pass a different CSS cursor as dragCursor, or dragCursor={false} to manage it yourself.
API reference
The payload type declared by kind flows to the root’s event handlers and keyboard callbacks.
Root
labelstring—
- Name
- Description
Human-readable name of this draggable, used by the default screen-reader announcements for keyboard drags. Defaults to a generic “item”. For full control over the announcement text, use
keyboardAnnouncementsinstead.- Type
ariaRoleDescriptionstring—
- Description
Value for
aria-roledescriptionon the drag handle, announcing the element as draggable to screen readers. Defaults to the text of the nearestLocalizationProvider.- Type
dragCursorstring | false'grabbing'
- Name
- Description
CSS cursor applied across the document during a pointer drag. The drag preview has
pointer-events: none, so otherwise the cursor would depend on the element under the pointer. Touch drags ignore this value. Passfalseto manage the cursor yourself.- Type
- Default
'grabbing'
getPayloadfunction—
- Name
- Description
Resolves payload data from the current drag context.
- Type
keyboardActivationDragKeyboardActivation'auto'
- Description
How keyboard dragging is started. See
DragKeyboardActivationfor the supported modes.- Type
- Default
'auto'
keyboardAnnouncementsUnion—
- Description
Screen-reader announcements for keyboard drags. Merged over the defaults; omit a callback to keep its default.
- Type
keyboardInstructionsstring—
- Description
Text for the shared keyboard-drag instructions node, read by a screen reader when the handle is focused. Defaults to the text of the nearest
LocalizationProvider.- Type
keyboardMovementUnion—
- Name
- Description
Controls how arrow keys move a keyboard drag. See
DragKeyboardMovement. Ignored whenkeyboardActivationis'off'.- Type
kind*Union—
- Name
- Description
The drag kind created with
Draggable.createKind. Drop targets and monitors list accepted kinds inaccept. The kind determines the type ofpayloadandsource.payload.- Type
modifiersDragModifiers—
- Name
- Description
Constrains pointer and keyboard movement with one modifier or an array applied in order. See
DragModifiersand the exported modifier presets.- Type
onBeforeDragStartfunction—
- Description
Event handler called when a drag is about to start, once the activation condition is met and before the preview is built and
getPayloadruns. CalleventDetails.cancel()to prevent the drag from starting.- Type
onDragfunction—
- Name
- Description
Event handler called as the pointer or keyboard cursor moves, limited to one call per animation frame. Drop target stack changes do not call this handler. Use the drop target’s
onDragfor hover behavior.- Type
onDragEndfunction—
- Name
- Description
Event handler called once when the drag ends after a drop, outside release, or cancellation. Use it to clean up or revert optimistic state. Commit a drop from
onDrop.eventDetails.reasonidentifies the outcome.- Type
onDragStartfunction—
- Name
- Description
Event handler called once, synchronously when the drag starts. The drag preview has already been resolved by then, so it is safe to measure or restyle the source from here.
- Type
onDropfunction—
- Name
- Description
Event handler called when the drag is released over an accepting drop target. Commit the move here.
dropTargetis nevernull. A drag that ends another way calls onlyonDragEnd.- Type
onDropTargetChangefunction—
- Description
Event handler called when the active drop targets change, because one was entered or left.
- Type
payloadTData—
- Name
- Description
Static payload data. Function values are preserved without being invoked.
- Type
pointerActivationDragActivationConfig—
- Description
Determines when a pointer press starts a drag. Mouse and pen use a 5px distance by default. Touch uses a 250ms press and hold. Pass one
DragActivationfor every pointer type or a map with per-type values. SeekeyboardActivationfor keyboard pickup.- Type
previewKeystring | number—
- Name
- Description
Stable identity used to reconnect a settling cloned preview to this source after it remounts. Use the same key for the same logical item across the move. Static payload identity is used as a fallback when it is referentially stable.
- Type
finalFocusUniontrue
- Name
- Description
Determines where focus moves after a keyboard drag. See
DragKeyboardFinalFocusfor the supported values. A pointer drag never moves focus.- Type
- Default
true
disabledbooleanfalse
- Name
- Description
Whether to disable dragging. Pointer presses and keyboard events keep their native behavior, and Base UI omits the keyboard-drag accessibility attributes. Use
onBeforeDragStartinstead when the decision depends on the gesture.- Type
- Default
false
childrenReact.ReactNode—
- Name
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-dragging
Present on the source element while it is being dragged.
A cloned preview never carries this attribute, so a [data-dragging]
rule that dims or hides the source leaves the preview fully visible.
data-disabled
Present while the draggable is disabled.
data-displacing
Present while Draggable.Displacement is animating this element being pushed aside
by a reorder, paired with the --drag-displacement-x/--drag-displacement-y
variables. Use it to apply the displacement transition.
data-drag-mode
The input method driving the drag, either 'pointer' or 'keyboard'.
Present on the source alongside data-dragging, and also on the preview.
data-starting-style
Present alongside data-displacing on the first frame of a displacement, while
the element should still sit at its old position. Style the displaced state
under it, and the transition under data-displacing without it.
data-ending-style
Present on the source after a deliberate release while a clone created by Base UI settles into its final position, including a return after release outside a target. Use it to keep the source styled as a placeholder until the preview’s ending animation finishes.
Attribute | Description | |
|---|---|---|
data-dragging | Present on the source element while it is being dragged.
A cloned preview never carries this attribute, so a | |
data-disabled | Present while the draggable is disabled. | |
data-displacing | Present while | |
data-drag-mode | The input method driving the drag, either | |
data-starting-style | Present alongside | |
data-ending-style | Present on the source after a deliberate release while a clone created by Base UI settles into its final position, including a return after release outside a target. Use it to keep the source styled as a placeholder until the preview’s ending animation finishes. | |
--drag-displacement-x
The horizontal distance, in pixels, from this element’s new layout position
to its previous position. It is calculated as previous minus current, so a
row that moved up has a positive value. Present with data-displacing. Apply
it under data-starting-style to transition the element to its new position.
--drag-displacement-y
The vertical counterpart of --drag-displacement-x.
CSS Variable | Description | |
|---|---|---|
--drag-displacement-x | The horizontal distance, in pixels, from this element’s new layout position
to its previous position. It is calculated as previous minus current, so a
row that moved up has a positive value. Present with | |
--drag-displacement-y | The vertical counterpart of | |
Draggable.Root.StateHide
Draggable.Root.PropsWithPayloadHide
Handle
nativeButtonbooleantrue
- Name
- Description
Whether the component renders a native
<button>element when replacing it via therenderprop. Set tofalseif the rendered element is not a button (for example,<div>).- Type
- Default
true
disabledundefined—
- Name
- Description
A handle has no independent disabled state. Setting
disabledhere would disable the button while leaving its root keyboard-draggable. SetdisabledonDraggable.Rootinstead.This prop is typed as
neverso passing it causes a type error.- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-disabled
Present while the handle’s Draggable.Root is disabled. A handle follows
the disabled state of its root.
Attribute | Description | |
|---|---|---|
data-disabled | Present while the handle’s | |
Draggable.Handle.StateHide
KeyboardHandle
nativeButtonbooleantrue
- Name
- Description
Whether the component renders a native
<button>element when replacing it via therenderprop. Set tofalseif the rendered element is not a button (for example,<div>).- Type
- Default
true
disabledundefined—
- Name
- Description
A handle has no independent disabled state. Set
disabledonDraggable.Rootinstead.- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-disabled
Present while the handle’s Draggable.Root is disabled.
Attribute | Description | |
|---|---|---|
data-disabled | Present while the handle’s | |
Draggable.KeyboardHandle.PropsHide
Re-Export of KeyboardHandle props as DraggableKeyboardHandleProps
Draggable.KeyboardHandle.StateHide
Preview
kindDragKind<TData>—
- Name
- Description
The source kind whose payload the render callback accepts.
- Type
modifiersDragModifiers—
- Name
- Description
Constrains the preview without affecting the drag. The resolved drop target and
location.current.inputremain unchanged. Here the modifier’spointis the preview’s proposed top-left andinputis the cursor. Runs on every positioned frame, so keep modifiers cheap.To constrain the drag itself, use
modifiersonDraggable.Root.- Type
offsetDragPreviewOffset'source'
- Name
- Description
Determines where the preview sits relative to the pointer. See
DragPreviewOffsetfor the supported values.- Type
- Default
'source'
containerDragPreviewContainer—
- Name
- Description
Determines where the preview is injected in the DOM. Defaults to the source’s own parent, so the app’s CSS still applies to it.
Pass a container to keep structural selectors such as
:nth-childand:last-childunchanged, or to keep the preview mounted if the source subtree unmounts. CSS selectors based on the source’s ancestors may no longer match.Draggable.PreviewProvidercan set the container for a whole subtree.- Type
disabledbooleanfalse
- Name
- Description
Whether to hide the preview. The drag continues while no preview is shown.
- Type
- Default
false
children| React.ReactNode
| ((parameters: DragPreviewRenderEvent<TData>) => React.ReactNode)
| ((parameters: DragPreviewRenderEvent) => React.ReactNode)—
| ((parameters: DragPreviewRenderEvent<TData>) => React.ReactNode)
| ((parameters: DragPreviewRenderEvent) => React.ReactNode)
- Name
- Description
Preview content, resolved once at drag start with the kind’s payload type.
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
data-drag-mode
The input method driving the drag, either 'pointer' or 'keyboard'. Use it
to transition the preview’s translate during keyboard drags without adding
a transition to pointer drags.
data-drag-preview
Present on the drag preview element. A cloned preview keeps the source’s classes, so use this attribute to distinguish them in CSS.
data-ending-style
Present on a cloned preview created by Base UI after a deliberate release while it moves to its final position. This also applies when a drag is released outside a target and returns to its source. The clone remains mounted until animations started by this state finish.
Attribute | Description | |
|---|---|---|
data-drag-mode | The input method driving the drag, either | |
data-drag-preview | Present on the drag preview element. A cloned preview keeps the source’s classes, so use this attribute to distinguish them in CSS. | |
data-ending-style | Present on a cloned preview created by Base UI after a deliberate release while it moves to its final position. This also applies when a drag is released outside a target and returns to its source. The clone remains mounted until animations started by this state finish. | |
--drag-source-height
The height of the element the drag was lifted from.
--drag-source-width
The width of the element the drag was lifted from.
CSS Variable | Description | |
|---|---|---|
--drag-source-height | The height of the element the drag was lifted from. | |
--drag-source-width | The width of the element the drag was lifted from. | |
Draggable.Preview.StateHide
ClonedPreview
modifiersDragModifiers—
- Name
- Description
Constrains the preview without affecting the drag. The resolved drop target and
location.current.inputremain unchanged. Here the modifier’spointis the preview’s proposed top-left andinputis the cursor. Runs on every positioned frame, so keep modifiers cheap.To constrain the drag itself, use
modifiersonDraggable.Root.- Type
offsetDragPreviewOffset'source'
- Name
- Description
Determines where the preview sits relative to the pointer. See
DragPreviewOffsetfor the supported values.- Type
- Default
'source'
containerDragPreviewContainer—
- Name
- Description
Determines where the preview is injected in the DOM. Defaults to the source’s own parent, so the app’s CSS still applies to it.
Pass a container to keep structural selectors such as
:nth-childand:last-childunchanged, or to keep the preview mounted if the source subtree unmounts. CSS selectors based on the source’s ancestors may no longer match.Draggable.PreviewProvidercan set the container for a whole subtree.- Type
disabledbooleanfalse
- Name
- Description
Whether to hide the preview. The drag continues while no preview is shown.
- Type
- Default
false
Draggable.ClonedPreview.PropsHide
Re-Export of ClonedPreview props as DraggableClonedPreviewProps
PreviewProvider
containerDragPreviewContainer—
- Name
- Description
Where to inject the previews of the sources inside this provider, overriding the default of the source’s own parent. A preview’s own
containerwins over it. A callback resolves it from the source, for example(source) => source.closest('.grid').- Type
childrenReact.ReactNode—
- Name
- Description
The part of your app whose custom drag previews render in this provider.
- Type
Draggable.PreviewProvider.PropsHide
Re-Export of PreviewProvider props as DraggablePreviewProviderProps
Draggable.PreviewProvider.StateHide
restrictToVerticalAxis
Locks the drag to the vertical axis at its initial horizontal position.
Parameters
DragModifierContext
point*DragPosition
- Name
- Description
The point being constrained, in client coordinates. On
Draggable.Rootthis is the cursor; on a preview part it is the preview’s proposed top-left.- Type
initialPoint*DragPosition
- Name
- Description
The same measure when the drag began, the reference an axis lock or grid snaps against.
- Type
input*DragPosition
- Name
- Description
The cursor this frame, in client coordinates. Identical to
pointonDraggable.Root; on a preview part it stays the cursor whilepointis the preview’s proposed top-left.- Type
sourceElement*HTMLElement
- Name
- Description
The drag source element.
- Type
sourceRect*DOMRect
- Name
- Description
The source element’s bounding rect at drag start.
- Type
scale*DragPosition
- Name
- Description
The scale applied to the source by CSS
transformorzoom, measured at drag start across the source and its ancestors.The value is
1when the source is not scaled. A rotation alone does not change it. On a zoomable canvas, multiply a distance in canvas coordinates by this value to convert it to client pixels. ThesnapToGridpreset does this automatically.- Type
previewRect*DOMRect | null
- Name
- Description
The preview element’s current rect, or
nullwhen there is no preview.- Type
previewOffset*DragPosition
- Name
- Description
The offset from the preview’s top-left to
point, so the preview is drawn atpoint − previewOffset.(0, 0)on a preview part and when there is no preview.- Type
mode*DragMode
- Name
- Description
The input method driving the drag.
- Type
ctrlKey*boolean
- Name
- Description
Whether the Control key was held by the event that produced this move.
During a pointer drag, pressing or releasing a modifier key reapplies the drag modifiers on the next frame. During a keyboard drag, the flags describe each arrow press. Ctrl, Alt, and Meta chords remain available for other shortcuts.
Check
modewith these flags because a key may behave differently for pointer and keyboard drags. For example, Shift increases the step used byfixedStepKeyboardMovement.- Type
shiftKey*boolean
- Name
- Description
Whether the Shift key was held by the event that produced this move. See
ctrlKey.- Type
altKey*boolean
- Name
- Description
Whether the Alt key was held by the event that produced this move. See
ctrlKey.- Type
metaKey*boolean
- Name
- Description
Whether the Meta (Command/Windows) key was held by the event that produced this move. See
ctrlKey.- Type
ownerWindow*Window
- Name
- Description
The document’s window, for viewport-relative modifiers.
- Type
Return value
DragPosition
xnumber
- Name
- Type
ynumber
- Name
- Type
restrictToHorizontalAxis
Locks the drag to the horizontal axis at its initial vertical position.
Parameters
DragModifierContext
point*DragPosition
- Name
- Description
The point being constrained, in client coordinates. On
Draggable.Rootthis is the cursor; on a preview part it is the preview’s proposed top-left.- Type
initialPoint*DragPosition
- Name
- Description
The same measure when the drag began, the reference an axis lock or grid snaps against.
- Type
input*DragPosition
- Name
- Description
The cursor this frame, in client coordinates. Identical to
pointonDraggable.Root; on a preview part it stays the cursor whilepointis the preview’s proposed top-left.- Type
sourceElement*HTMLElement
- Name
- Description
The drag source element.
- Type
sourceRect*DOMRect
- Name
- Description
The source element’s bounding rect at drag start.
- Type
scale*DragPosition
- Name
- Description
The scale applied to the source by CSS
transformorzoom, measured at drag start across the source and its ancestors.The value is
1when the source is not scaled. A rotation alone does not change it. On a zoomable canvas, multiply a distance in canvas coordinates by this value to convert it to client pixels. ThesnapToGridpreset does this automatically.- Type
previewRect*DOMRect | null
- Name
- Description
The preview element’s current rect, or
nullwhen there is no preview.- Type
previewOffset*DragPosition
- Name
- Description
The offset from the preview’s top-left to
point, so the preview is drawn atpoint − previewOffset.(0, 0)on a preview part and when there is no preview.- Type
mode*DragMode
- Name
- Description
The input method driving the drag.
- Type
ctrlKey*boolean
- Name
- Description
Whether the Control key was held by the event that produced this move.
During a pointer drag, pressing or releasing a modifier key reapplies the drag modifiers on the next frame. During a keyboard drag, the flags describe each arrow press. Ctrl, Alt, and Meta chords remain available for other shortcuts.
Check
modewith these flags because a key may behave differently for pointer and keyboard drags. For example, Shift increases the step used byfixedStepKeyboardMovement.- Type
shiftKey*boolean
- Name
- Description
Whether the Shift key was held by the event that produced this move. See
ctrlKey.- Type
altKey*boolean
- Name
- Description
Whether the Alt key was held by the event that produced this move. See
ctrlKey.- Type
metaKey*boolean
- Name
- Description
Whether the Meta (Command/Windows) key was held by the event that produced this move. See
ctrlKey.- Type
ownerWindow*Window
- Name
- Description
The document’s window, for viewport-relative modifiers.
- Type
Return value
DragPosition
xnumber
- Name
- Type
ynumber
- Name
- Type
restrictToParentElement
Keep the drag within the source element’s parent.
Parameters
DragModifierContext
point*DragPosition
- Name
- Description
The point being constrained, in client coordinates. On
Draggable.Rootthis is the cursor; on a preview part it is the preview’s proposed top-left.- Type
initialPoint*DragPosition
- Name
- Description
The same measure when the drag began, the reference an axis lock or grid snaps against.
- Type
input*DragPosition
- Name
- Description
The cursor this frame, in client coordinates. Identical to
pointonDraggable.Root; on a preview part it stays the cursor whilepointis the preview’s proposed top-left.- Type
sourceElement*HTMLElement
- Name
- Description
The drag source element.
- Type
sourceRect*DOMRect
- Name
- Description
The source element’s bounding rect at drag start.
- Type
scale*DragPosition
- Name
- Description
The scale applied to the source by CSS
transformorzoom, measured at drag start across the source and its ancestors.The value is
1when the source is not scaled. A rotation alone does not change it. On a zoomable canvas, multiply a distance in canvas coordinates by this value to convert it to client pixels. ThesnapToGridpreset does this automatically.- Type
previewRect*DOMRect | null
- Name
- Description
The preview element’s current rect, or
nullwhen there is no preview.- Type
previewOffset*DragPosition
- Name
- Description
The offset from the preview’s top-left to
point, so the preview is drawn atpoint − previewOffset.(0, 0)on a preview part and when there is no preview.- Type
mode*DragMode
- Name
- Description
The input method driving the drag.
- Type
ctrlKey*boolean
- Name
- Description
Whether the Control key was held by the event that produced this move.
During a pointer drag, pressing or releasing a modifier key reapplies the drag modifiers on the next frame. During a keyboard drag, the flags describe each arrow press. Ctrl, Alt, and Meta chords remain available for other shortcuts.
Check
modewith these flags because a key may behave differently for pointer and keyboard drags. For example, Shift increases the step used byfixedStepKeyboardMovement.- Type
shiftKey*boolean
- Name
- Description
Whether the Shift key was held by the event that produced this move. See
ctrlKey.- Type
altKey*boolean
- Name
- Description
Whether the Alt key was held by the event that produced this move. See
ctrlKey.- Type
metaKey*boolean
- Name
- Description
Whether the Meta (Command/Windows) key was held by the event that produced this move. See
ctrlKey.- Type
ownerWindow*Window
- Name
- Description
The document’s window, for viewport-relative modifiers.
- Type
Return value
DragPosition
xnumber
- Name
- Type
ynumber
- Name
- Type
restrictToElement
Keep the drag within an element’s bounds. Pass the element, a ref object, or a function returning it. The rect is read on every constrained move, so a container that scrolls or resizes between moves is tracked.
Parameters
element*DragElementReference—
- Name
- Type
Return value
restrictToWindowEdges
Keep the drag within the viewport.
Parameters
DragModifierContext
point*DragPosition
- Name
- Description
The point being constrained, in client coordinates. On
Draggable.Rootthis is the cursor; on a preview part it is the preview’s proposed top-left.- Type
initialPoint*DragPosition
- Name
- Description
The same measure when the drag began, the reference an axis lock or grid snaps against.
- Type
input*DragPosition
- Name
- Description
The cursor this frame, in client coordinates. Identical to
pointonDraggable.Root; on a preview part it stays the cursor whilepointis the preview’s proposed top-left.- Type
sourceElement*HTMLElement
- Name
- Description
The drag source element.
- Type
sourceRect*DOMRect
- Name
- Description
The source element’s bounding rect at drag start.
- Type
scale*DragPosition
- Name
- Description
The scale applied to the source by CSS
transformorzoom, measured at drag start across the source and its ancestors.The value is
1when the source is not scaled. A rotation alone does not change it. On a zoomable canvas, multiply a distance in canvas coordinates by this value to convert it to client pixels. ThesnapToGridpreset does this automatically.- Type
previewRect*DOMRect | null
- Name
- Description
The preview element’s current rect, or
nullwhen there is no preview.- Type
previewOffset*DragPosition
- Name
- Description
The offset from the preview’s top-left to
point, so the preview is drawn atpoint − previewOffset.(0, 0)on a preview part and when there is no preview.- Type
mode*DragMode
- Name
- Description
The input method driving the drag.
- Type
ctrlKey*boolean
- Name
- Description
Whether the Control key was held by the event that produced this move.
During a pointer drag, pressing or releasing a modifier key reapplies the drag modifiers on the next frame. During a keyboard drag, the flags describe each arrow press. Ctrl, Alt, and Meta chords remain available for other shortcuts.
Check
modewith these flags because a key may behave differently for pointer and keyboard drags. For example, Shift increases the step used byfixedStepKeyboardMovement.- Type
shiftKey*boolean
- Name
- Description
Whether the Shift key was held by the event that produced this move. See
ctrlKey.- Type
altKey*boolean
- Name
- Description
Whether the Alt key was held by the event that produced this move. See
ctrlKey.- Type
metaKey*boolean
- Name
- Description
Whether the Meta (Command/Windows) key was held by the event that produced this move. See
ctrlKey.- Type
ownerWindow*Window
- Name
- Description
The document’s window, for viewport-relative modifiers.
- Type
Return value
DragPosition
xnumber
- Name
- Type
ynumber
- Name
- Type
snapToGrid
Snap the drag to a grid, anchored at the point where the drag began. Pass a
single number for a square grid or { x, y } for a rectangular one. A
non-positive step leaves that axis unsnapped.
The step uses the source’s coordinate system. For example, snapToGrid(20)
still snaps to a 20-unit grid when the canvas is zoomed to 70%.
Parameters
size*Union—
- Name
- Type
Return value
targetsOnlyKeyboardMovement
A keyboardMovement preset that moves only between accepting drop targets.
Each arrow press moves to the nearest target in that direction. If no target
is available, nothing moves. Use it for sortable lists and boards where empty
space is not a valid drop position.
direction*DragPosition—
- Name
- Description
Unit vector for
key.ArrowUpis{ x: 0, y: -1 }.- Type
event*KeyboardEvent—
- Name
- Description
The native
keydownevent.- Type
findTarget*function—
- Name
- Description
Runs the default directional collision and returns the nearest accepting drop target ahead of the cursor, or
nullwhen none lies ahead. Passkeyto look in another direction than the pressed one, andfromto look from another origin than the current cursor.- Type
getTargets*function—
- Name
- Description
Returns every drop target accepting this drag, with freshly measured rects.
- Type
key*DragKeyboardArrowKey—
- Name
- Description
The arrow key pressed.
- Type
location*DragLocationHistory—
- Name
- Description
Where the drag started and where it is now, including its drop targets.
- Type
position*DragPosition—
- Name
- Description
The virtual cursor before this press, in client coordinates.
- Type
shiftKey*boolean—
- Name
- Description
Whether the Shift key was held. No multiplier is applied to a resolver result.
- Type
source*DragSource—
- Name
- Description
The drag source being moved.
- Type
suggestion*DragKeyboardMoveSuggestion—
- Name
- Description
What the default behavior would do for this press.
- Type
target*DropTargetRecord | null—
- Name
- Description
The innermost drop target currently under the virtual cursor, or
null.- Type
fixedStepKeyboardMovement
A keyboardMovement preset that moves by a fixed step without finding a drop target.
Use it on a canvas where every point is valid. The default target search could otherwise move the source across the canvas when a drop target is registered.
step uses the source’s coordinate system, so an ancestor scale() does not
change the distance on a zoomable canvas. Holding Shift moves four times as far.
Parameters
step*Union—
- Name
- Type
Return value
DragModifier
Modifies the drag position. Use it to lock an axis, snap to a grid, or constrain the drag to an element or window. It receives the proposed point and returns the point to use.
Prebuilt modifiers: restrictToVerticalAxis, restrictToHorizontalAxis,
restrictToWindowEdges, restrictToParentElement, restrictToElement, snapToGrid.
Parameters
DragModifierContext
point*DragPosition
- Name
- Description
The point being constrained, in client coordinates. On
Draggable.Rootthis is the cursor; on a preview part it is the preview’s proposed top-left.- Type
initialPoint*DragPosition
- Name
- Description
The same measure when the drag began, the reference an axis lock or grid snaps against.
- Type
input*DragPosition
- Name
- Description
The cursor this frame, in client coordinates. Identical to
pointonDraggable.Root; on a preview part it stays the cursor whilepointis the preview’s proposed top-left.- Type
sourceElement*HTMLElement
- Name
- Description
The drag source element.
- Type
sourceRect*DOMRect
- Name
- Description
The source element’s bounding rect at drag start.
- Type
scale*DragPosition
- Name
- Description
The scale applied to the source by CSS
transformorzoom, measured at drag start across the source and its ancestors.The value is
1when the source is not scaled. A rotation alone does not change it. On a zoomable canvas, multiply a distance in canvas coordinates by this value to convert it to client pixels. ThesnapToGridpreset does this automatically.- Type
previewRect*DOMRect | null
- Name
- Description
The preview element’s current rect, or
nullwhen there is no preview.- Type
previewOffset*DragPosition
- Name
- Description
The offset from the preview’s top-left to
point, so the preview is drawn atpoint − previewOffset.(0, 0)on a preview part and when there is no preview.- Type
mode*DragMode
- Name
- Description
The input method driving the drag.
- Type
ctrlKey*boolean
- Name
- Description
Whether the Control key was held by the event that produced this move.
During a pointer drag, pressing or releasing a modifier key reapplies the drag modifiers on the next frame. During a keyboard drag, the flags describe each arrow press. Ctrl, Alt, and Meta chords remain available for other shortcuts.
Check
modewith these flags because a key may behave differently for pointer and keyboard drags. For example, Shift increases the step used byfixedStepKeyboardMovement.- Type
shiftKey*boolean
- Name
- Description
Whether the Shift key was held by the event that produced this move. See
ctrlKey.- Type
altKey*boolean
- Name
- Description
Whether the Alt key was held by the event that produced this move. See
ctrlKey.- Type
metaKey*boolean
- Name
- Description
Whether the Meta (Command/Windows) key was held by the event that produced this move. See
ctrlKey.- Type
ownerWindow*Window
- Name
- Description
The document’s window, for viewport-relative modifiers.
- Type
Return value
DragPosition
xnumber
- Name
- Type
ynumber
- Name
- Type
DragKeyboardMovement
Controls how arrow keys move a keyboard drag. Called on every arrow press with the press, the drag context, and the suggested move.
direction*DragPosition—
- Name
- Description
Unit vector for
key.ArrowUpis{ x: 0, y: -1 }.- Type
event*KeyboardEvent—
- Name
- Description
The native
keydownevent.- Type
findTarget*function—
- Name
- Description
Runs the default directional collision and returns the nearest accepting drop target ahead of the cursor, or
nullwhen none lies ahead. Passkeyto look in another direction than the pressed one, andfromto look from another origin than the current cursor.- Type
getTargets*function—
- Name
- Description
Returns every drop target accepting this drag, with freshly measured rects.
- Type
key*DragKeyboardArrowKey—
- Name
- Description
The arrow key pressed.
- Type
location*DragLocationHistory—
- Name
- Description
Where the drag started and where it is now, including its drop targets.
- Type
position*DragPosition—
- Name
- Description
The virtual cursor before this press, in client coordinates.
- Type
shiftKey*boolean—
- Name
- Description
Whether the Shift key was held. No multiplier is applied to a resolver result.
- Type
source*DragSource<TSourceData>—
- Name
- Description
The drag source being moved.
- Type
suggestion*DragKeyboardMoveSuggestion—
- Name
- Description
What the default behavior would do for this press.
- Type
target*DropTargetRecord | null—
- Name
- Description
The innermost drop target currently under the virtual cursor, or
null.- Type
createKind
Creates a drag kind with a unique runtime identity. Declare it once and share the returned value with each draggable, drop target, monitor, and auto-scroller that participates in the interaction. The optional name is only a debugging aid; separately created kinds do not match.
createGlobalKind
Creates a globally interned drag kind for integrations where independently evaluated bundles must match without sharing the same kind value.
The key is the runtime identity, so every call with the same key matches, including
calls made by another copy of the bundle. It must be namespaced (for example,
'myapp/card') because using the same key with incompatible payload types bypasses
TypeScript and causes the integrations to exchange the wrong payload at runtime.
Prefer createKind when the kind value can be shared directly.
Parameters
key*string—
- Name
- Description
A namespaced global key such as
'myapp/card'.- Type
Return value
DragKind
namestring
- Name
- Description
The name or global key used to create this kind. This is not an accessible name. Use
labelon a draggable or drop target instead.- Type
idsymbol
- Name
- Description
The kind’s runtime identity.
createKindcreates a fresh symbol for each call;createGlobalKindinterns it on the namespaced key.- Type
matchesmatches
- Name
- Description
Whether this drag source is of this kind, narrowing its
payloadtoTPayload.- Type
useActiveDrag
Pass one kind or an array of kinds to accept. Other drags return null, and accept determines the type of source.payload.
Subscribes to the drag currently in progress, and returns its source, or null if
there is none. Observes every drag, regardless of which element started it.
Pass one kind or an array of kinds to accept to observe only matching drags.
Other drags return null, and accept determines the source payload type.
Parameters
acceptDragKind | DragKind[]—
- Name
- Type