Transfer
Brief Introduction
The Transfer shuttle box component is used to move data options between two columns. mengyue-components has encapsulated it and performed vitest testing. You can use <MYTransfer></MYTransfer> to implement data shuttle functionality.
Basic Usage
Basic Transfer
Basic transfer box component, supports moving data between left and right columns.
Code Demo
List One
- Option Three
- Option Four
- Disabled Option
List Two
- Option One
- Option Two
展开代码
Custom Titles
Use the titles property to customize the titles of the left and right columns.
Code Demo
Source List
- Apple
- Orange
- Mango
Target List
- Banana
- Grape
展开代码
Custom Colors
Use the backgroundColor, colorText, and hoverBackground properties to customize the colors of the transfer box.
Code Demo
Light Theme
- Option Two
- Option Four
Light Theme
- Option One
- Option Three
展开代码
Dark Theme
Create a dark-themed transfer box using dark backgrounds.
Code Demo
Dark Theme
- Project One
- Project Three
- Project Four
Dark Theme
- Project Two
- Project Five
展开代码
Disabled Options
Data containing disabled options; users cannot select or move these options.
Code Demo
Available List
- Selectable One
- Disabled One
- Selectable Three
- Disabled Two
- Selectable Four
Selected List
- Selectable Two
展开代码
Dynamic Data
Create a transfer box with a dynamic data source.
Code Demo
All Users
- Jane Smith
- Alice Brown
- Charlie Wilson
Selected Users
- John Doe
- Bob Johnson
Selected Users: John Doe, Bob Johnson
展开代码
API Reference
Transfer Props
| Parameter | Description | Type | Options | Default |
|---|---|---|---|---|
| modelValue | Array of keys for selected items | number[] | — | [] |
| data | Data source | Option[] | — | [] |
| titles | Custom titles for left/right lists | string[] | — | [] |
| backgroundColor | Background color | string | — | '' |
| colorText | Text color | string | — | '' |
| hoverBackground | Hover background color | string | — | '' |
Data Type
typescript
interface Option {
key: number;
label: string;
disabled: boolean;
}
interface TransferProps {
modelValue: number[];
data: Option[];
titles?: string[];
backgroundColor?: string;
colorText?: string;
hoverBackground?: string;
}