Skip to main content

Basic usage

This python package provides two new Dash components: SortableGroup and SortableItem. A SortableGroup must only contain SortableItem components and exposes in callbacks the sortedIDs property which can be used to retrieve the order of the children. Each SortableItem is a Dash component that can be dragged and sorted within its parent group. See below for a typical example.

Note: Drag and drop can be cancelled at any moment by pressing the Esc key

import dash
from   dash_sortable_items import SortableGroup, SortableItem

app = dash.Dash(__name__)

item1 = SortableItem(
    id       = 'item1',
    children = [dash.html.Label('Row #1')],
)

item2 = SortableItem(
    id       = 'item2',
    children = [dash.html.Label('Row #2')],
)

item3 = SortableItem(
    id       = 'item3',
    children = [dash.html.Label('Row #3')],
)

group = SortableGroup(
    id    = 'group',
    items = [item1, item2, item3],
)

app.layout = group

app.run(debug=True)

Note that all SortableItem component must have id provided as it uniquely identifies the component in its parent group.

Callbacks

The order of the SortableItem components can be recovered via a callback as follows

@app.callback(
    ...
    dash.Input('group', 'sortedIds')
)
def callback(sortedIds: list[str] | None) -> str:

    if sortedIDs is None: raise dash.exceptions.PreventUpdate
    
    return sortedIds

For more details on SortableGroup and SortableItem see the documentation.

Metadata

Release files for dash-sortable-items 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for dash-sortable-items 0.7.1
File Interpreter ABI Platform
dash_sortable_items-0.7.1-py3-none-any.whl Python 3 none any Details

Release files / dash_sortable_items-0.7.1-py3-none-any.whl

Download URL dash_sortable_items-0.7.1-py3-none-any.whl
Size 69.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e163fe5c075c93c621d4550a13f74385f1905dc7885b2aa746de3ec9c7ee2f12
BLAKE2b-256 checksum
How to use checksums
3c9ac21bd553e933a0c1fdb1095e8ff5ae5a66e4fd0852e1879348e666a8df50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.2

1 release file

This release

0.7.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page