Skip to content

makeConstraintArea

makeConstraintArea marks an element as a constraint area: drag movement can be limited to an axis or kept inside this element's bounds. It must be used inside a DnDProvider. Throws if the provider is not found.

Signature

ts
makeConstraintArea(ref, options?): {}
  • ref — template ref to the container element. The element is registered on mount and unregistered on unmount.
  • options — optional. Defaults: axis: 'both', restrictToArea: false.

Returns an empty object (reserved for future use).


Options

OptionTypeDescription
axis'x' | 'y' | 'both' | Ref<TDragAxis>Restrict drag to this axis. Default: 'both'.
restrictToAreaboolean | Ref<boolean>When true, confine the drag to the constraint area bounds. Default: false.

See also

Released under the MIT License.