HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • Meter
  • Multi Select
  • Native Select
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
Blocks
  • Airtable
  • Airtable Kanban
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Sortable

PreviousNext

A list you reorder by dragging, with a handle, keyboard support and a short settle where the item lands. Works vertically, horizontally or as a grid.

Base UIReact AriaRadix UI

Month end, in order

1.Reconcile bank feeds

RBC chequing and the Visa card

2.Match receipts

23 receipts waiting since Friday

3.Send open invoices

4 clients, $12,480 CAD

4.Chase overdue payments

2 invoices past 30 days

Dashboard tabs

Overview
Invoices
Expenses
GST/HST

Drag a tab to move it. Order: Overview, Invoices, Expenses, GST/HST.

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/sortable.json

Usage#

import {
  Sortable,
  SortableHandle,
  SortableItem,
  SortableOverlay,
} from "@/components/ui/sortable"
const [steps, setSteps] = React.useState([
  { id: "bank", title: "Reconcile bank feeds" },
  { id: "receipts", title: "Match receipts" },
])
 
<Sortable value={steps} onValueChange={setSteps}>
  {steps.map((step) => (
    <SortableItem key={step.id} value={step.id}>
      <Item variant="outline">
        <ItemContent>{step.title}</ItemContent>
        <ItemActions>
          <SortableHandle />
        </ItemActions>
      </Item>
    </SortableItem>
  ))}
  <SortableOverlay>
    {({ value }) => <Item variant="outline">{value}</Item>}
  </SortableOverlay>
</Sortable>

Handles#

Put a SortableHandle inside each item, so the rest of the row keeps its own clicks. Or pass asHandle to SortableItem to drag the whole item, which suits chips and tabs. SortableHandle takes asChild to turn any element into the handle.

Keyboard and touch#

Focus a handle, press Space to pick the item up, use the arrow keys to move it, and press Space again to drop. Escape puts it back. On phones, press and hold to pick up, so the page still scrolls.

Drop cue#

The item you drop swells a touch and a soft ring fades out, with a tap sound. Picking up plays a select sound. The settle stays still when reduced motion is on.

Props#

  • Sortable. value and onValueChange hold the list. Items can be strings, numbers or objects with an id. For anything else, pass getItemValue. orientation is vertical, horizontal or grid, and locks dragging to that axis. modifiers replaces the lock. onMove gets the old and new index after a drop. asChild renders the list as its child.
  • SortableItem. value is the item id. asHandle makes the whole item the handle. disabled keeps it in place. It sets data-dragging and data-dropped for styling.
  • SortableHandle. A ghost icon Button with the six dot grip. Pass children or asChild to change it.
  • SortableOverlay. What follows the pointer. Pass a node, or a function that gets the dragged item's value. With an overlay, the item left behind fades.
SonnerSpinner

On This Page

InstallationUsageHandlesKeyboard and touchDrop cueProps