Reorder List
Reorder a vertical queue with pointer or keyboard input while the application owns persistence.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
editable | boolean | false | Enables pointer and keyboard reordering. |
drag-start-threshold | number | 10 | Minimum summed pointer movement in CSS pixels before pickup. Invalid values use 10. |
auto-scroll-disabled | boolean | false | Prevents component-driven scrolling of the nearest eligible vertical ancestor. |
swipeable | boolean | false | Lets users swipe an item sideways to reveal its swipe actions. Items with data-swipe="false" do not swipe. |
swipe-actions | ReorderSwipeAction[] | [...defaultSwipeActions] | The actions a swipe reveals, as an array of ReorderSwipeAction (a JSON array in the attribute). The first action
of each side is the outermost one, which a full swipe runs. Defaults to a single red Delete on the end side. |
Slots
| Name | Description |
|---|---|
(default) | Ordinary direct-child items. Numeric or private slot metadata is assigned internally and is not consumer API. |
placeholder | Optional destination feedback shown only during pointer reordering. |
dragging-item | Optional pointer preview shown only during pointer reordering. |
Events
| Name | Type | Description |
|---|---|---|
swipe-action | CustomEvent<ReorderSwipeActionEventDetail> | Fired when a swipe action runs, from its button, a full swipe or its key. Bubbles, crosses shadow boundaries and is cancelable: the delete action removes the item unless the event is canceled. |
reorder | CustomEvent<ReorderEventDetail> | Fired once after a real committed user reorder. Bubbles and crosses shadow boundaries; not cancelable. |
change | CustomEvent<number[]> | Deprecated numeric permutation emitted with reorder during the compatibility window. |
reorder-error | CustomEvent<ReorderErrorEventDetail> | Fired when duplicate non-empty item keys prevent pickup. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
container | Ordered-list layout and component-owned spacing boundary. |
item | Repeated component-owned placement wrapper around the default slot's assigned ordinary item; styles placement, not assigned content. |
placeholder | Component-owned destination marker wrapping the placeholder slot or its visible fallback; styles placement, not assigned content. |
dragging-item | Fixed-position component-owned preview region wrapping the dragging-item slot or its recognizable fallback; styles placement, not assigned content. |
swipe-content | With swipeable, the sliding layer around an item's slot; styles placement, not assigned content. |
swipe-actions | With swipeable, the layer behind an item holding its revealed actions. |
swipe-action | One revealed swipe action button. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-reorder-list--container-border-width | length | 0px | Container border width. |
--c2-reorder-list--container-border-color | color | #bcbcc6 | Container border color. |
--c2-reorder-list--container-border-radius | length | 8px | Container corner radius. |
--c2-reorder-list--container-padding | length | 0px | Container padding. |
--c2-reorder-list--container-margin | length | 0px | Container margin. |
--c2-reorder-list--container-gap | length | 0px | Space between item placements. |
--c2-reorder-list--item-background | color | transparent | Item placement background. |
--c2-reorder-list--item-padding | length | 0px | Item placement padding. |
--c2-reorder-list--divider-height | length | 0px | Divider thickness. |
--c2-reorder-list--divider-color | color | #bcbcc6 | Divider color. |
--c2-reorder-list--placeholder-background | color | rgb(37 99 235 / 8%) | Placeholder background. |
--c2-reorder-list--dragging-item-background | color | transparent | Pointer-preview background. |
--c2-reorder-list__item__focus--outline-width | length | 2px | Keyboard focus-ring width. |
--c2-reorder-list__item__focus--outline-color | color | #2563eb | Keyboard focus-ring color. |
--c2-reorder-list__item__focus--outline-offset | length | 2px | Keyboard focus-ring offset. |
--c2-reorder-list__item__active--opacity | number | 0.45 | Active source opacity. |
--c2-reorder-list__placeholder--border-width | length | 2px | Destination border width. |
--c2-reorder-list__placeholder--border-style | string | dashed | Destination border style. |
--c2-reorder-list__placeholder--border-color | color | #2563eb | Destination border color. |
--c2-reorder-list__placeholder--border-radius | length | 0px | Destination corner radius. |
--c2-reorder-list__dragging-item--opacity | number | 0.92 | Pointer-preview opacity. |
--c2-reorder-list__dragging-item--box-shadow | box-shadow | 0 12px 28px rgb(15 23 42 / 24%) | Pointer-preview shadow. |
--c2-reorder-list__dragging-item--border-radius | length | 0px | Pointer-preview corner radius. |
--c2-reorder-list__dragging-item--padding | length | var(--c2-reorder-list--item-padding, 0px) | Padding of the pointer preview's fallback label; follows the item padding by default. |
--c2-reorder-list__motion--duration | time | 160ms | Decorative transition duration; zero under reduced motion. |
--c2-reorder-list__motion--timing-function | easing-function | ease | Decorative transition easing. |
--c2-reorder-list__swipe-action--width | length | 76px | Width of each revealed swipe action. |
--c2-reorder-list__swipe-action--color | color | #ffffff | Label and icon colour of the swipe actions. |
--c2-reorder-list__swipe-action--font-size | length | 12px | Label size of the swipe actions. |
--c2-reorder-list__swipe-action__danger--background-color | color | #dc2626 | Background of a danger action, such as Delete. |
--c2-reorder-list__swipe-action__warning--background-color | color | #a16207 | Background of a warning action, such as Archive. |
--c2-reorder-list__swipe-action__success--background-color | color | #15803d | Background of a success action, such as Done. |
--c2-reorder-list__swipe-action__accent--background-color | color | #0265dc | Background of an accent action. |
--c2-reorder-list__swipe-action__neutral--background-color | color | #52525b | Background of a neutral action. |
--c2-reorder-list__swipe-content--background-color | color | #ffffff | Background of the sliding layer, which hides the actions until an item is swiped. |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under reorder-list, and the nearest lang asks for it; any message not translated stays in English. {0}, {1}… stand for the values a message carries. Languages guide.
| Key | English | Values |
|---|---|---|
instructions | Press Space to pick up an item. Use Arrow keys, Home, or End to move it; Space drops and Escape cancels. | — |
swipeShortcut | Press {0} to {1}. | {0} key {1} action |
item | Item | — |
pickedUp | {0} picked up, position {1} of {2}. Use Arrow keys, Home, or End to move; Space drops and Escape cancels. | {0} label {1} position {2} count |
returned | {0} returned to position {1}. | {0} label {1} position |
atFirst | {0} is already at the first permitted position. | {0} label |
atLast | {0} is already at the last permitted position. | {0} label |
moved | {0} moved to position {1} of {2}. | {0} label {1} position {2} count |
dropped | {0} moved from position {1} to {2}. | {0} label {1} from {2} to |
swipeOpen | {0}: {1} available. Press Escape to close. | {0} label {1} actions |
deleted | {0} deleted. | {0} label |
actionDone | {0}: {1}. | {0} action {1} label |
duplicateKey | Reordering is unavailable because the item key {0} is used more than once. | {0} key |
canceled | Reordering canceled. The item returned to its original position. | — |
canceledNotEditable | Reordering canceled because editing is no longer available. | — |
canceledItemsChanged | Items changed. Reordering canceled. | — |
canceledItemHidden | Reordering canceled because the item is not visible. | — |
canceledListHidden | Reordering canceled because the item or list is not visible. | — |
canceledPointerLost | Reordering canceled because pointer control was lost. | — |