PhiaUi.Components.MultiDrag (phia_ui v0.1.17)

Copy Markdown View Source

Multi-select drag-and-drop list component for PhiaUI.

Wraps sortable_item/1 items with multi-selection behaviour powered by the PhiaMultiDrag hook. Supports click, Ctrl/Meta+click, and Shift+click selection, then dragging all selected items together.

Example

<.multi_drag_list id="tasks" on_reorder="multi_reorder">
  <.sortable_item :for={{item, idx} <- Enum.with_index(@items)}
    id={item.id} index={idx}>
    {item.title}
  </.sortable_item>
</.multi_drag_list>

Summary

Functions

Renders a multi-select sortable list backed by the PhiaMultiDrag hook.

Functions

multi_drag_list(assigns)

Renders a multi-select sortable list backed by the PhiaMultiDrag hook.

Items support multi-selection (click, Ctrl+click, Shift+click). Dragging any selected item moves the entire selection. The hook emits on_reorder with %{ids: ["id1", "id2", ...], new_index: N}.

Attributes

  • id (:string) (required)
  • on_reorder (:string) - Defaults to "multi_reorder".
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)