---
title: Reorder
description: "`Reorder` is a component that allows you to change the order of items using drag and drop."
links:
- style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/reorder/reorder.style.ts
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/reorder
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-reorder--basic
---
```tsx
虎杖悠仁
伏黒恵
釘崎野薔薇
五条悟
七海建人
```
## Usage
```tsx
import { Reorder } from "@yamada-ui/react"
```
```tsx
import { Reorder } from "@/components/ui"
```
```tsx
import { Reorder } from "@workspaces/ui"
```
```tsx
虎杖悠仁
伏黒恵
釘崎野薔薇
```
### Use items
```tsx
const items = useMemo(
() => [
{ value: "虎杖悠仁", label: "虎杖悠仁" },
{ value: "伏黒恵", label: "伏黒恵" },
{ value: "釘崎野薔薇", label: "釘崎野薔薇" },
{ value: "五条悟", label: "五条悟" },
{ value: "七海建人", label: "七海建人" },
],
[],
)
return
```
### Change Variant
```tsx
const items = useMemo(
() => [
{ value: "虎杖悠仁", label: "虎杖悠仁" },
{ value: "伏黒恵", label: "伏黒恵" },
{ value: "釘崎野薔薇", label: "釘崎野薔薇" },
],
[],
)
return (
}>
)
```
### Change Size
```tsx
const items = useMemo(
() => [
{ value: "虎杖悠仁", label: "虎杖悠仁" },
{ value: "伏黒恵", label: "伏黒恵" },
{ value: "釘崎野薔薇", label: "釘崎野薔薇" },
],
[],
)
return (
}>
)
```
### Change Orientation
To change the orientation, set `orientation` to `"vertical"` or `"horizontal"`. By default, `"vertical"` is set.
```tsx
const items = useMemo(
() => [
{ value: "虎杖悠仁", label: "虎杖悠仁" },
{ value: "伏黒恵", label: "伏黒恵" },
{ value: "釘崎野薔薇", label: "釘崎野薔薇" },
{ value: "五条悟", label: "五条悟" },
],
[],
)
return (
}>
)
```
### Limit the Draggable Area
To limit the draggable area, use `ReorderTrigger`.
```tsx
虎杖悠仁
伏黒恵
釘崎野薔薇
```
### Handle Completion Events
If you want to handle the event when the user's drag and drop has finished and the order of items is completed, use `onCompleteChange`. `onCompleteChange` provides the completed order as an array.
```tsx
const items = useMemo(
() => [
{ value: "虎杖悠仁", label: "虎杖悠仁" },
{ value: "伏黒恵", label: "伏黒恵" },
{ value: "釘崎野薔薇", label: "釘崎野薔薇" },
{ value: "五条悟", label: "五条悟" },
],
[],
)
const [completedOrder, setCompletedOrder] = useState([
"虎杖悠仁",
"伏黒恵",
"釘崎野薔薇",
"五条悟",
])
return (
Completed order: {completedOrder.join(", ")}
setCompletedOrder(values)}
/>
)
```
### Use in Scrollable Area
When using in an area with scroll, set `layoutScroll` to `true` to ensure items can measure their offsets correctly.
```tsx
const items = useMemo(
() => [
{ value: "虎杖悠仁", label: "虎杖悠仁" },
{ value: "伏黒恵", label: "伏黒恵" },
{ value: "釘崎野薔薇", label: "釘崎野薔薇" },
{ value: "五条悟", label: "五条悟" },
{ value: "七海建人", label: "七海建人" },
],
[],
)
return (
)
```
### Control
```tsx
const items = useMemo(
() => [
{ value: "虎杖悠仁", label: "虎杖悠仁" },
{ value: "伏黒恵", label: "伏黒恵" },
{ value: "釘崎野薔薇", label: "釘崎野薔薇" },
{ value: "五条悟", label: "五条悟" },
],
[],
)
const [values, setValues] = useState([
"虎杖悠仁",
"伏黒恵",
"釘崎野薔薇",
"五条悟",
])
return (
Current order: {values.join(", ")}
setValues(newValues)}
/>
)
```
## Props
### Reorder.Root
| Prop | Default | Type | Description |
| ------------------ | ------------ | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `as` | - | `keyof IntrinsicElements` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"lg" \| "md" \| "sm" \| "xl"` | The size of the component. |
| `variant` | `"panel"` | `"elevated" \| "outline" \| "panel" \| "plain" \| "solid" \| "subtle" \| "surface" ...` | The variant of the component. |
| `items` | - | `ReorderItemProps[]` | If provided, generate reorder items based on items. |
| `onChange` | - | `(values: Y[]) => void` | The callback invoked when reorder items are moved. |
| `onCompleteChange` | - | `(values: Y[]) => void` | The callback invoked when the movement of reorder items is completed. |
| `orientation` | `"vertical"` | `"horizontal" \| "vertical"` | The orientation of the reorder. |
### Reorder.Item
| Prop | Default | Type | Description |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------ |
| `as` | - | `keyof IntrinsicElements` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `label` | - | `string \| number \| bigint \| boolean \| ReactElement> \| Iterable \| ReactPortal \| Promise<...>` | The label of the reorder item. |
| `value` | - | `NonNullable` | The value of the reorder item. |
### Reorder.Trigger
| Prop | Default | Type | Description |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |