Logo
Layout

Reorderable List

Drag items into a new order or transfer them between lists

Overview

Reorderable List lets users rearrange UI items by dragging.

Preview

Usage

Add Reorderable List to a UI container and assign List Container.

Populate the container and call RefreshItemsList() when adding children directly.

Configure the drag scale, opacity, and rearrangement animation.


Customization

Transfers

Enable Allow List Transfer on participating lists and give them the same Transfer Group. They must share a root Canvas. Assign Drop Area to a viewport when the visible drop target differs from the list container. onListChanged reports the item, source list, and destination list.

Layout

An attached layout group controls spacing; Item Spacing is used when no layout group is attached. Instant Snap skips the rearrangement animation.


Public API

Use ReorderableList in the Evo.UI namespace.

Call CancelDrag() before changing the hierarchy during a drag. DetachItem() removes an item from list management without destroying its GameObject.

Properties

NameTypeDescription
IsDraggingActiveboolWhether an item is being dragged.
IsAnimatingboolWhether rearrangement is animating.

Fields

NameTypeDescription
allowListTransferboolEnables transfer between compatible lists.
transferGroupstringGroup name shared by lists that may exchange items.
dropAreaRectTransformOptional drop target rectangle.

Methods

NameParametersDescription
Items()NoneReturns tracked ReorderableListItem entries. Returns List<ReorderableListItem>.
AddExistingItem()RectTransform itemRegisters an existing RectTransform as a list item.
AddExistingItem()GameObject itemRegisters an existing GameObject as a list item.
RemoveItem()ReorderableListItem itemRemoves an item and destroys its GameObject.
RemoveItem()GameObject itemGoRemoves an item and destroys its GameObject.
DetachItem()RectTransform itemRectStops managing a RectTransform without deleting it.
ClearItems()NoneClears the list and destroys its item GameObjects.
RefreshItemsList()NoneCollects items after hierarchy changes.
RefreshLayout()NoneUpdates item positions.
CancelDrag()NoneCancels the current drag.

Events

NameTypeDescription
onOrderChangedUnityEvent<ReorderableListItem, int, int>Item, previous index, and new index.
onListChangedUnityEvent<ReorderableListItem, ReorderableList, ReorderableList>Item, source list, and destination list.

Example

ReorderableListExample.cs
using UnityEngine;
using Evo.UI;

public class ReorderableListExample : MonoBehaviour
{
    [SerializeField] private ReorderableList target;

    private void Start()
    {
        target.allowListTransfer = true;
        target.transferGroup = "Inventory";
        target.RefreshItemsList();
        target.onOrderChanged.AddListener((item, before, after) =>
            Debug.Log($"Moved {before} to {after}"));
    }
}

On this page