Transfer
A double-column transfer selector featuring thick borders, hard shadow offsets, and active press feedback characteristic of Neo-Brutalist design.
Item interaction
Row checkboxes represent pending transfer choices; modelValue determines target-panel membership. Checking a row does not transfer it. Headers retain checked and indeterminate states. Classic uses lemon yellow with black text; other presets retain their own highlight pairs. See theme customization.
Preview
基础用法
可搜索过滤
自定义标题和按钮文字
Installation
pnpm dlx brutx-vue@latest add transferUsage
Basic Usage
<script setup>
import { ref } from 'vue'
import { Transfer } from 'brutx-ui-vue'
const data = ref([
{ key: 1, label: 'Option 1' },
{ key: 2, label: 'Option 2' },
{ key: 3, label: 'Option 3', disabled: true },
{ key: 4, label: 'Option 4' }
])
const value = ref([1])
</script>
<template>
<Transfer v-model="value" :data="data" />
</template>Search & Filter
Enable search and filtering functionality by setting the filterable property to true.
Each panel header shows the number of items checked for transfer out of the panel total, including disabled items in the total. Search filters the visible rows, and the header checkbox acts on visible, enabled items. Checked items hidden by the search still count toward the pending total and move when you press the transfer button.
Inside a native form, pressing plain Enter in either search field keeps the query and checked items in place. Input methods can still use Enter to confirm a candidate. The transfer buttons move checked items, and the form's own submit button handles submission.
<template>
<Transfer v-model="value" :data="data" filterable />
</template>Custom Titles and Button Texts
You can customize the headers and action buttons using the titles and buttonTexts props respectively.
<template>
<Transfer
v-model="value"
:data="data"
:titles="['Source items', 'Target items']"
:button-texts="['Undo', 'Add']"
/>
</template>API Reference
| Name | Type | Default | Description |
|---|---|---|---|
class | string | undefined | undefined | Custom CSS classes added to the transfer root container. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/transfer/Transfer.vue | |||
modelValue | (string | number)[] | undefined | []Factory evaluated per instance | The keys of items in the right target panel, bound with v-model. |
DetailsDeclared type(string | number)[] | undefined Default value details
Sourcepackages/ui/src/components/transfer/Transfer.vue | |||
data | TransferDataItem[] | undefined | []Factory evaluated per instance | The transfer data source. Each item has a key and label, and may be disabled to prevent moving it. |
DetailsDeclared typeTransferDataItem[] | undefined Referenced types TransferDataItem Type definition — TransferDataItemexport interface TransferDataItem {
key: string | number
label: string
disabled?: boolean
}Default value details
Sourcepackages/ui/src/components/transfer/Transfer.vue | |||
filterable | boolean | undefined | false | Shows a filter input in each panel. |
DetailsDeclared typeboolean | undefined Literal values
Default value details
Sourcepackages/ui/src/components/transfer/Transfer.vue | |||
filterMethod | ((query: string, item: TransferDataItem) => boolean) | undefined | undefined | Custom query-to-item matcher; return true to keep an item in the filtered results. |
DetailsDeclared type((query: string, item: TransferDataItem) => boolean) | undefined Referenced types TransferDataItem Type definition — TransferDataItemexport interface TransferDataItem {
key: string | number
label: string
disabled?: boolean
}Default value details
Sourcepackages/ui/src/components/transfer/Transfer.vue | |||
titles | string[] | undefined | undefined | Sets the source and target panel titles in order; localized defaults are used when both titles are not supplied. |
DetailsDeclared typestring[] | undefined Default value details
Sourcepackages/ui/src/components/transfer/Transfer.vue | |||
buttonTexts | string[] | undefined | undefined | Sets the left and right transfer button labels in order; direction icons are shown when labels are omitted. |
panelWidth | number | undefined | 260 | Sets the width of each panel in pixels. |
DetailsDeclared typenumber | undefined Default value details
Sourcepackages/ui/src/components/transfer/Transfer.vue | |||
panelHeight | number | undefined | 400 | Sets the height of each panel in pixels. |
DetailsDeclared typenumber | undefined Default value details
Sourcepackages/ui/src/components/transfer/Transfer.vue | |||
| Name | Signature or type | Description |
|---|---|---|
@update:modelValue | [value: (string | number)[]] | Emits the updated target key array when the right-side selection changes so v-model can be updated. |
DetailsDeclared type[value: (string | number)[]] Sourcepackages/ui/src/components/transfer/Transfer.vue | ||
@change | [value: (string | number)[], direction: "right" | "left", movedKeys: (string | number)[]] | Emits the updated target keys, movement direction, and keys moved in this operation. |
DetailsDeclared type[value: (string | number)[], direction: "right" | "left", movedKeys: (string | number)[]] Literal values
Sourcepackages/ui/src/components/transfer/Transfer.vue | ||
Data Types
interface TransferDataItem {
key: string | number
label: string
disabled?: boolean
}Exported Types
import type { TransferDataItem } from 'brutx-ui-vue'Accessibility
- Keyboard Interaction:
- Checkboxes inside each column panel support selection using
Space/Enterkeys - Action buttons support focus via
Tabkey and activation usingEnter/Spacekeys
- Checkboxes inside each column panel support selection using
- ARIA Attributes: Operation buttons are equipped with
aria-labelto state transfer direction ("Move selected to right" / "Move selected to left"). Checked items are managed and presented via standard checkboxes - Focus Management: The transfer buttons retain focus after items are moved, allowing efficient consecutive keyboard operations