--- import DefaultLayout from '@shared/layouts/DefaultLayout.astro' import DocsLink from '@ui/DocsLink.astro' import Avatar from '@ui/Avatar.astro' import Card from '@ui/Card.astro' import CardHeader from '@ui/CardHeader.astro' import CardBody from '@ui/CardBody.astro' import CardTitle from '@ui/CardTitle.astro' import CardSubtitle from '@ui/CardSubtitle.astro' import Icon from '@ui/Icon.astro' import ListGroup from '@ui/ListGroup.astro' import ListGroupItem from '@ui/ListGroupItem.astro' import Signal from '@ui/Signal.astro' import { people, personById } from '@shared/lib/people' import tasks from '@data/tasks.json' interface Task { name: string assigned_to: number priority: string } interface Column { name: string tasks: Task[] } const priorities: Record = { High: { value: 3, color: 'red' }, Medium: { value: 2, color: 'orange' }, Low: { value: 1, color: 'blue' }, } const board = (tasks.columns as Column[]).map((column) => ({ name: column.name, tasks: column.tasks.slice(0, 4), })) const selectedTopics = ['Design', 'Development', 'Marketing'] const availableTopics = ['Sales', 'Support', 'Analytics', 'Legal', 'Finance', 'Research', 'Security', 'Hiring'] const team = people.slice(0, 5) const gallery = people.slice(5, 11) const sections = [ { title: 'Basics', description: 'Add data-sortable with SortableJS options as JSON to any list to make its children draggable.' }, { title: 'Handles and tables', description: 'Limit dragging to a grip icon, or reorder the rows of a table.' }, { title: 'Boards', description: 'Connect several lists to build a kanban board, a pick list or a nested tree.' }, { title: 'Selection and swapping', description: 'The bundled SortableJS build also ships the MultiDrag and Swap plugins.' }, ] ---

{sections[0]!.title}

{sections[0]!.description}

Basic usage Drag to reorder items within a single list.
Element A Element B Element C Element D
Two lists with drag and drop Give lists the same group to move items between them.
Item 1 Item 2 Item 3
Item A Item B Item C
Horizontal lists Set direction to horizontal for rows of tags, and drag them between the two rows.
Selected
{selectedTopics.map((topic) => {topic})}
Available
{availableTopics.map((topic) => {topic})}
Fixed items Set filter to a selector to make matching items impossible to drag.
Inbox (pinned) Projects Reports Archive Trash (pinned)

{sections[1]!.title}

{sections[1]!.description}

Drag handle Set handle so only the grip starts a drag, and the rest of the row stays clickable.
{ team.map((person) => (
{person.full_name}
{person.job_title}
)) }
Sortable table Put data-sortable on the tbody to reorder rows.
{ team.map((person) => ( )) }
Drag Name Title Country
{person.full_name} {person.job_title} {person.country}
Grid of avatars Sortable also works on a wrapping layout, not just on vertical lists.
{ gallery.map((person) => (
{person.first_name}
)) }
Disabled list Set disabled to true to lock a list, for example while the user has no edit rights.
Read-only item 1 Read-only item 2 Read-only item 3

{sections[2]!.title}

{sections[2]!.description}

Kanban board Drag tasks between columns that share one group. Set forceFallback to true to drag a tilted copy with a shadow instead of the browser preview.
{ board.map((column) => (

{column.name}

{column.tasks.map((task) => (
{task.name}
{task.priority}
))}
)) }
Clone from a list Use pull: "clone" and put: false on the source so items are copied, not moved.
Templates
Heading Paragraph Image Button
Page
Paragraph
One-way transfer Set put: false on a list to make it a source only, and use it to build a pick list.
Available
Email alerts SMS alerts Weekly digest Push notifications
Selected
In-app messages
Nested lists Put a sortable list inside an item and give all lists one group to move items between levels.
Design
Wireframes Prototype
Development
Frontend Backend Tests
Launch
Release notes

{sections[3]!.title}

{sections[3]!.description}

Multiple selection Set multiDrag to true. Hold Ctrl or ⌘ and click to select items, then drag them together.
Invoice #1001 Invoice #1002 Invoice #1003 Invoice #1004 Invoice #1005
Swap Set swap to true to exchange two items instead of shifting the rest.
First place Second place Third place Fourth place