Skip to main content

Reorder

shadow

Reorder is a component that allows you to use the Drag&Drop functionality to reorder the ReorderItem items in a group.

Basic usage

Attribute Disabled

The disabled attribute is used to disable the ability to reorder items within a Reorder. When this attribute is set, the user will not be able to drag items to change their order.

Handle for pulling

By adding an item to the handle slot of the ReorderItem item, you can define a specific area that will serve as a handle for dragging and rearranging items. This allows users to interact more intuitively when changing the order of items.

Attribute Reverse - Reverse order

The reverse attribute is used to change the direction of reordering items within a Reorder.

Drop Zones

DropZone is a component that represents a zone intended for rearranging content.

Attributes and Properties

disabled

DescriptionIf true, rearrangement is disabled.
Attributedisabled
Typeboolean
Defaultfalse

reverse

DescriptionIf true, the direction of rearrangement is reversed (bottom-up).
Attributereverse
Typeboolean
Defaultfalse

Events

NameDescription
wje-reorder:changeInvoked when changing the order of elements.

Methods

attachEventListeners

DescriptionConnects event listeners to the element.
SignatureattachEventListeners(element) => void

startDragging

DescriptionInitializes the pull process for the reorderable element.
SignaturestartDragging(clientX, clientY, target) => void

moveElement

DescriptionUpdates the position of the dragged element and manages the reordering logic based on the mouse position.
SignaturemoveElement(pageX, pageY) => void

StopDragging

DescriptionStops the element from dragging.
SignaturestopDragging() => void

dispatchChange

DescriptionTransmits a custom event signaling that a rearrangement has occurred.
SignaturedispatchChange(from, to, order) => void

CSS Shadow Parts

NameDescription
nativeThe native part of the reorder component, containing the slot.

CSS Custom Properties

NameDescription
--flex-directionDirection of flexbox for container

Slots

NameDescription
``The default location of the element content. This includes elements of type wje-reorder-item.