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

DragHandle

  • Stable
  • WCAG 2.2 evidence
  • RTL

Grip that starts a drag of the collection item it sits in. Built on React Aria Button with slot="drag": inside a draggable GridList item, Enter starts a keyboard drag, Tab or the arrow keys pick a drop position, Enter drops and Escape cancels, and every step is announced (WCAG 2.1.1, 4.1.2, 4.1.3). Grabbed is not a prop: the item being dragged carries data-dragging and the handle follows it. Dragging always needs a single-pointer alternative (WCAG 2.5.7): use it inside SortableItem / BoardCard, whose lists offer Move up, Move down and Move to column actions, or provide equivalent actions yourself. The 24 x 32 px box meets the 24 px minimum target size (WCAG 2.5.8).

import { DragHandle } from "@nexera-ui/react";
Loading example…
3
examples
18
props
1
live controls
1
platform
9
WCAG criteria
0
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…
isDisabled
Generated code
import { DragHandle } from "@nexera-ui/react";

<DragHandle />

Examples 2

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

In sortable list

The handle in a sortable list: Enter on the handle starts a keyboard drag; the Move menu is the single-pointer alternative.

Loading example…

In kanban board

The handle on Kanban cards: drag across columns, or use Move to column in the card's menu.

Loading example…

Props 18

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

18 props shown

aria-labelNexera
string

Accessible name. Leave it unset inside a draggable GridList / ListBox item: React Aria then names the handle "Drag <item text>" in the provider locale. Set it only when the handle is used outside such an item.

Default –
slotNexera
string | null

React Aria slot. "drag" connects the handle to the enclosing draggable collection item, which supplies the keyboard and screen reader drag behaviour, the name and the disabled state.

Default drag
classNameNexera
string

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

Default –
styleNexera
CSSProperties

Inline style.

Default –
isDisabledReact Aria
boolean

Whether the button is disabled.

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 –
autoFocusReact Aria
boolean

Whether the element should receive focus on render.

Default –
typeReact Aria
"button" | "submit" | "reset"

The behavior of the button when used in an HTML form.

Default 'button'
formReact Aria
string

The <form> element to associate the button with. The value of this attribute must be the id of a <form> in the same document. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#form).

Default –
nameReact Aria
string

Submitted as a pair with the button's value as part of the form data.

Default –
valueReact Aria
string

The value associated with the button's name when it's submitted with the form data.

Default –
idReact Aria
string

The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

Default –
aria-labelledbyReact Aria
string

Identifies the element (or elements) that labels the current element.

Default –
aria-describedbyReact Aria
string

Identifies the element (or elements) that describes the object.

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 · 2 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.11Non-text ContrastLevel 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

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-disabled
  • data-dragging
  • data-hovered
  • data-pressed
Usage
<DragHandle className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

No block uses DragHandle yet.

Related components