Transfer

Bootstrap 5 Transfer plugin

Transfer component allows you to transfer the data between two columns.

Transfer plugin built with the latest Bootstrap 5. Transfer data between two columns. Supports disabled items, one way transfer, pagination, and more.

Note: Read the API tab to find all available options and advanced customization


Basic example

To create basic example just add main div container and initialize its via JavaScript.


Disabled items

To make some of elements unable to select just add 'disabled: true' property to proper item.


Checked items

By adding property 'checked: true' to item during initialization you can make element mark.


One way

By adding 'oneWay: true' property you can set your component to transfer data only to target table.


Pagination

By adding 'pagination: true' you can set pagination on transfer component.


Pagination with custom quantity

Furthermore, if you want to set custom number of elements per page then just use 'elementsPerPage' property.


Transfer - API


Usage

Via JavaScript


        const transfer = new Transfer(document.getElementById('mdb-transfer'), options)
      

Via jQuery

Note: By default, MDB does not include jQuery and you have to add it to the project on your own.


        $('.example-class').transfer(options);
      

Options

Name Type Default Description
dataTarget Array '[]' Add data to target table
dataSource Array '[]' Add data to source table
elementsPerPage Number '5' Work only with 'pagination:true'. Set number of items per page
oneWay Boolean 'false' Allows you to set a way of sending data between tables
pagination Boolean 'false' Add pagination to your transfer component
search Boolean 'false' Add search box to trnsfer component
selectAll Boolean 'true' Add select all checkbox to component
titleTarget String 'Target' Changes title of target table
titleSource String 'Source' Changes title of source table
toTargetArrow String '' Changes text of right arrow
toSourceArrow String '' Changes test of left arrow

Methods

Name Description Example
dispose Manually removes transfer transfer.dispose()
getInstance Static method which allows you to get the transfer instance associated to a DOM element. Transfer.getInstance(transferEl)

        const transferEl = document.getElementById('mdb-transfer'); 
        const transfer = new Transfer(transferEl);
        transfer.toggle();
      

Events

Name Description
onChange.mdb.transfer This event fires immediately when the data changes.
onSearch.mdb.transfer This event fires immediately when you search some items in search box.
onSelect.mdb.transfer This event fires immediately when you select some item.

        const transferEl = document.getElementById('mdb-transfer')
        transferEl.addEventListener('change.mdb.transfer', (e) => {
          // do something...
        })
      

Import

MDB UI KIT also works with module bundlers. Use the following code to import this component:


        import Transfer from 'mdb-transfer';