Skip to content
ghostui

Ranking field

Let people order options with drag, keyboard, and explicit move actions.

Preview

  1. Cite sources
  2. Use workspace context
  3. Ask before taking action

Installation

Install

Basic usage

The id is the stable identity. The value and onValueChange pair contains ids in their current order. When name is supplied, hidden form controls submit those ids in the same order. Use Field for the visible label.

Structures

Examples

Sortable list

Drag any part of a row to move the whole item. Its up and down actions appear on hover or keyboard focus and stay visible on touch devices. Focus a row and use Alt+ArrowUp, Alt+ArrowDown, Alt+Home, or Alt+End for direct moves; Enter starts accessible dragging and Escape cancels it.

  1. Cite sources
  2. Use workspace context
  3. Ask before taking action

Add and remove custom options

Set allowCustomOptions to show the quiet add action. Blank and duplicate labels are rejected. Custom rows expose a remove action; built-in rows stay protected.

  1. Cite sources
  2. Use workspace context
  3. Ask before taking action

API reference

The component composes canonical Button, IconButton, ButtonGroup, and Input owners. Dragging is progressive enhancement: the move buttons and documented keyboard commands provide the same result without pointer drag support. An offscreen polite status announces the resulting position or custom-option change.

Native div attributes and a div ref are supported on the root. Labels and business validation belong to the caller.