Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

SortableItem

  • Stable
  • WCAG 2.2 evidence
  • RTL

One row of a sortable list: drag handle, label and meta. A React Aria GridListItem, so it must be rendered in a SortableList (or your own GridList with useDragAndDrop). States come from React Aria (rule G1): Hover data-hovered, Focused data-focus-visible, Dragging data-dragging, Disabled isDisabled (data-disabled, the handle is dimmed and a lock icon is shown); Placeholder is SortableItemPlaceholder. Inside a SortableList the row also has a Move menu (Move up / Move down): the single-pointer alternative to dragging (WCAG 2.5.7). Keyboard: arrow keys move between rows and into the handle and the menu; Enter on the handle starts a keyboard drag (WCAG 2.1.1). The row is named by textValue and described by meta (WCAG 4.1.2, 1.3.1). Consumer duty: labels that identify each item; why an item is disabled (the lock is decorative).

import { SortableItem } from "@nexera-ui/react";
Loading example…
4
examples
24
props
2
live controls
1
platform
13
WCAG criteria
2
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
label
isDisabled
Generated code
import { SortableItem } from "@nexera-ui/react";

<SortableItem />

Examples 3

The same examples as Storybook, rendered live. Open Code to copy one.

Sortable checklist

A realistic onboarding checklist. Drag a row, or use the keyboard (arrow to the handle, Enter, arrows, Enter), or the Move menu (Move up / Move down), the single-pointer alternative to dragging (WCAG 2.5.7). The first task is locked.

Loading example…

Kanban board

A small Kanban board built from the same parts: Board, BoardColumn, BoardCard; empty columns show the Placeholder.

Loading example…

Long labels

Labels and meta wrap instead of truncating (translations can add 30 to 40 %).

Loading example…

Props 24

Press "Try it" on a card to load that prop into the playground.

24 props shown

label*Nexera
ReactNode

Primary text. Lead with what people scan for; it wraps instead of truncating.

Default –
metaNexera
ReactNode

Secondary line under the label, for example "Day 1 · HR". Read as the row description.

Default –
textValueNexera
string

Plain-text version of the label, used for typeahead, the drag handle name ("Drag <text>") and announcements. Defaults to label when it is a string; required when label is not plain text.

Default –
classNameNexera
string

Extra classes, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style.

Default –
idReact Aria
Key

The unique id of the item.

Default –
valueReact Aria
object

The object value that this item represents. When using dynamic collections, this is set automatically.

Default –
isDisabledReact Aria
boolean

Whether the item is disabled.

Default –
onActionReact Aria
() => void

Handler that is called when a user performs an action on the item. The exact user event depends on the collection's selectionBehavior prop and the interaction modality.

Default –
focusModeReact Aria
"child" | "row"

Whether the row or its first focusable child element should be focused when navigating to the row. Defaults to 'row'.

Default –
allowsArrowNavigationReact Aria
boolean

Whether the row should support arrow key navigation even when the containing collection uses tab keyboard navigation. Allows users to navigate between rows with arrow keys while focus is on an interactive child element within the row.

Default –
hrefReact Aria
string

A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href).

Default –
hrefLangReact Aria
string

Hints at the human language of the linked URL. See[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang).

Default –
targetReact Aria
HTMLAttributeAnchorTarget

The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target).

Default –
relReact Aria
string

The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).

Default –
downloadReact Aria
string | boolean

Causes the browser to download the linked URL. A string may be provided to suggest a file name. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download).

Default –
pingReact Aria
string

A space-separated list of URLs to ping when the link is followed. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#ping).

Default –
referrerPolicyReact Aria
"" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"

How much of the referrer to send when following the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#referrerpolicy).

Default –
routerOptionsReact Aria
never

Options for the configured client side router.

Default –
onPressReact Aria
(e: PressEvent) => void

Handler that is called when the press is released over the target.

Default –
onPressStartReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction starts.

Default –
onPressEndReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.

Default –
onPressChangeReact Aria
(isPressed: boolean) => void

Handler that is called when the press state changes.

Default –
onPressUpReact Aria
(e: PressEvent) => void

Handler that is called when a press is released over the target, regardless of whether it started on the target or not.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

7 direct · 6 supporting
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.1Use of ColorLevel A · supporting test
  • 1.4.4Resize TextLevel AA · supporting test
  • 1.4.10ReflowLevel AA · supporting test
  • 1.4.11Non-text ContrastLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.3Focus OrderLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · tested directly
  • 2.5.7Dragging MovementsLevel AA · tested directly
  • 2.5.8Target Size (Minimum)Level AA · supporting test
  • 4.1.2Name, Role, ValueLevel A · tested directly
  • 4.1.3Status MessagesLevel AA · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-allows-dragging
  • data-disabled
  • data-dragging
  • data-drop-target
  • data-hovered
  • data-pressed
Usage
<SortableItem className="data-allows-dragging:opacity-90 shadow-sm" />

Used in blocks

Related components