Skip to main content

SortableGrid

Function SortableGrid 

Source
pub fn SortableGrid(_: SortableGridProps) -> Element
Expand description

A grid of tiles reordered (or swapped) by dragging.

Renders a display: grid wrapper with cols equal columns — pass your own class/style for gaps and sizing (your grid-template-columns wins if you set one, since spread attributes land after the default). The hovered tile gets data-drop-target="true", the dragged one data-dragging="true".

§Props

For details, see the props struct definition.

  • len : usize

    Number of tiles.

  • cols : usize

    Number of columns.

  • render : Callback<usize,Element>

    Renders the tile at the given index.

  • on_sort : EventHandler<SortEvent>

    Fired when the user drops a tile on another.

  • mode : ReorderMode

    Insert-and-reflow (gallery) or swap (dashboard). Default: insert.

  • attributes : Vec<Attribute>