ValyroUI English version

Sortable

Сортировка перетаскиванием. Бесплатно, MIT · Данные и показатели › Списки и деревья

Установка

npx valyro-cli@latest add sortable
npx shadcn@latest add https://valyro.xyz/r/sortable.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { Sortable } from 'valyro-ui';

Пропсы

PropTypeDefault
itemsreadonly T[]Controlled items, in order.
defaultItemsreadonly T[]Initial items when uncontrolled.
onReorder(items: T[], move: SortableMove<T>) => voidCalled after a drop that changed the order (pointer or keyboard).
getKey(item: T) => SortableKeyStable key of an item. Defaults to item.id, or the item itself for strings and numbers.
children *(item: T, state: SortableItemState) => ReactNodeRenders one item; also renders the copy that follows the pointer (state.isOverlay).
layout'vertical' | 'horizontal' | 'grid''vertical'grid matches drop positions in both directions and moves rows with ArrowUp / ArrowDown.
handlebooleanfalseOnly a SortableHandle inside the item starts a drag; the rest of the item stays interactive.
disabledbooleanfalseTurn off reordering: no item can be picked up by pointer or keyboard, and handles are disabled.
isItemDisabled(item: T) => booleanItems that can't be picked up (others can still move past them).
getItemLabel(item: T) => stringItem name for announcements and handle labels. Defaults to "item 3".
labelsPartial<SortableLabels>Overrides for the built-in English text; keys left out keep their defaults.

Похожие компоненты

  • List Block — Блок списка с картинками или иконками, описанием и значением
  • Description List — Список «ключ — значение»: столбиком, строками или сеткой с иконками
  • Tree View — Древовидные структуры
  • Accordion — Раскрывающиеся секции
  • JSON Viewer — Просмотр JSON
  • Timeline — Хронология событий
  • Data Table — Таблицы с поиском и сортировкой
  • Data Grid — Таблица на 100 000 строк: группировка, фильтры, редактирование
  • Virtual List — Виртуальный список на 100 000 строк
  • Bulk Action Bar — Панель действий над выбранными строками с горячими клавишами
  • Card — Универсальные карточки
  • Item Card — Карточка-строка: иконка, заголовок, описание и элемент управления справа

Назад: Accordion · Далее: JSON Viewer · Весь раздел «Данные и показатели»