Tesserae

SortableStack

Description

SortableStack is a stack-based container whose child items can be reordered with drag and drop. It wraps a standard Stack internally, tracks a stable identifier for each item, and reports the updated ordering when the user finishes sorting.

Use it when the visual order matters and you need to persist or react to that order, such as dashboards, pinned lists, or configurable layouts.

Usage

Create a SortableStack through the SortableStack(...), VSortableStack(), or HSortableStack() helpers. Add items with stable identifiers, then listen for sorting changes.

Methods

  • Add(string identifier, IComponent component) adds a component with a stable identifier.
  • Add(SortableStackItem item) adds a prebuilt sortable item.
  • Children(params SortableStackItem[] children) replaces the current children with a new ordered set.
  • LoadSorting(string[] itemOrder) applies a saved identifier order after items have been added.
  • OnSortingChanged(Action<string[]> onSortingChanged) registers a callback for completed reorder operations.
  • AlignItems(...), AlignItemsCenter(), AlignContent(...), JustifyContent(...), and JustifyItems(...) forward layout settings to the inner stack.
  • Wrap(), NoWrap(), Relative(), RemovePropagation(), and NoDefaultMargin() configure layout behavior.
  • Clear() removes all items.
  • Remove(string identifier) removes a single item by identifier.
  • Render() returns the underlying HTML element.

Properties

  • Background gets or sets the stack background.
  • Margin gets or sets the stack margin.
  • Padding gets or sets the stack padding.
  • CanWrap controls whether items may wrap.
  • StylingContainer exposes the element used for special styling.
  • PropagateToStackItemParent indicates whether styling should propagate to parent stack items.

SortableStackItem

Each draggable entry is represented by SortableStackItem.

  • Identifier is the unique key used for ordering.
  • Component is the rendered child component.

See also

Referenced by

© 2026 Tesserae. All rights reserved.