Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Drag and Drop Rows Table Block for React

A print job queue where rows are reordered with Move up and Move down buttons or by dragging a grip, and a Starts at column recomputes from the order and the durations.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Let people set the order of rows, with this drag and drop rows table for React with Base UI. Six print jobs sit in a native table in the order the press runs them, each with its copies and how long it takes, and a Starts at column that is worked out from the order: the first job starts at 09:00 and each next one when the one before it ends, so every move recomputes it. Each row has Move up and Move down buttons, which are the whole interaction for a keyboard: focus stays on the button that was pressed, or goes to its partner when the job reached an end of the queue, and a polite line says "Menu cards moved to position 2 of 6". The grip at the start of a row also takes a pointer drag, as an extra, with no library, and a Reset button puts the queue back as booked. It's built from Button and Guides. For job queues, playlists, priorities and any list where order is data.

FAQ

Can I reorder without a pointer?

Yes, and that is the baseline. Every row has Move up and Move down buttons named with the job ("Move Menu cards up"). Pressing one moves the job one place, keeps focus on the same button so you can press it again, and the status line says where the job is now. At the first or last place the button stays pressable and answers in words instead of doing nothing.

How does the pointer drag work?

Pressing the grip captures the pointer on the table body; as it moves over the other rows, the dragged job takes the place of the row under it, and it stays where it is let go. It uses plain pointer events (no library), and the grip is hidden from assistive technology because the buttons already do the job. On a phone the grip is not shown and the buttons are the way.

Where does Starts at come from?

It is never typed. A helper adds the durations of every job before a row to the 09:00 opening time, so after any move the whole column recomputes, and the line over the table gives the new end of the day.

What does Reset do?

It puts the six jobs back in the order they were booked. It is always on the page; when the queue is already in that order it is quiet and, if pressed, says so in the status line.

How does it look on a phone?

The grip, Copies and Duration go, the copies and minutes move under the job's name, and the position, the start time and both Move buttons stay. Nothing scrolls sideways at 320 pixels.

What stays local, and how do I wire it for real?

The queue is typed in the file and the order is plain state, so nothing is sent to a press. To save the order, send the list of ids in shift and when a drag ends in drop, and load the saved order as the starting state.

  • Pro

    A list of five digest sections with Move up and Move down buttons and a pointer-drag grip; a drawn digest preview follows the order, and each move is announced.

  • Pro

    Column Reorder Table

    Columns and paging

    A pipeline table with a Column order list beside it: Move earlier and Move later buttons reorder the columns and announce the move, a grip drags as an extra, and Reset restores the default order.

  • Pro

    Sortable Members Table

    Sort and search

    A members table whose column heads are buttons: press one to sort, again to reverse, a third time for the original order, with aria-sort on the active head, ties settled by name and a spoken line for each result.

  • Pro

    Bulk Actions Table

    Select and act

    A contacts table whose head checkbox ticks the page, a strip that offers to select all 48 contacts across pages, a toolbar that swaps to Archive, Tag and Delete at the same height, and an Undo receipt.

  • Pro

    Row Selection Table

    Select and act

    A stock list with a checkbox on every row, a head checkbox that shows a dash when only some are ticked, Shift-click range select and a live line that adds up the price of the ticked rows.

  • Pro

    A sales forecast grid where every number is a field, with live row and column totals, a dot on each changed cell, arrow keys and Enter between regions, Undo and Reset.