The Double Select Box component provides a user interface for moving items between two select boxes. It’s useful for scenarios where users need to select items from a list and move them to another list, such as assigning permissions, selecting features, or organizing items into categories.
This component has no additional dependencies beyond the core Metro UI library.
< div data-role = "double-select-box" >
< option value = "1" > Item 1 </ option >
< option value = "2" > Item 2 </ option >
< option value = "3" > Item 3 </ option >
< option value = "4" > Item 4 </ option >
<!-- Initially empty or with pre-selected items -->
< div data-role = "double-select-box" >
< option value = "ie" data-template = " < span class='mif-ie'> < /span> $1" > IE </ option >
< option value = "chrome" data-template = " < span class='mif-chrome'> < /span> $1" > Chrome </ option >
< option value = "firefox" data-template = " < span class='mif-firefox'> < /span> $1" > Firefox </ option >
< option value = "safari" data-template = " < span class='mif-safari'> < /span> $1" > Safari </ option >
< option value = "opera" data-template = " < span class='mif-opera'> < /span> $1" > Opera </ option >
Parameter Type Default Description heightstring ”auto” Height of the select boxes multiSelectboolean false Allows selecting multiple items at once moveRightIconstring ”›“ Icon for the move right button moveRightAllIconstring ”»“ Icon for the move all right button moveLeftIconstring ”‹“ Icon for the move left button moveLeftAllIconstring ”«“ Icon for the move all left button clsBoxstring "" Additional CSS class for the component container clsMoveButtonstring "" Additional CSS class for all move buttons clsMoveRightButtonstring "" Additional CSS class for the move right button clsMoveRightAllButtonstring "" Additional CSS class for the move all right button clsMoveLeftButtonstring "" Additional CSS class for the move left button clsMoveLeftAllButtonstring "" Additional CSS class for the move all left button clsListLeftstring "" Additional CSS class for the left list clsListRightstring "" Additional CSS class for the right list
Metro . doubleSelectBoxSetup ({
// Component instance setup
const doubleSelectBox = Metro . getPlugin ( "#myDoubleSelectBox" , "double-select-box" );
destroy() - Removes the component from the DOM.
const doubleSelectBox = Metro . getPlugin ( "#myDoubleSelectBox" , "double-select-box" );
doubleSelectBox . destroy ();
Event Description onDoubleSelectBoxCreateTriggered when the component is created
Variable Default (Light) Dark Mode Description --double-select-border-radius4px 4px Border radius of the select boxes --double-select-border-colorvar(—border-color) var(—border-color) Border color of the select boxes --double-select-item-background-active#e6e6e6 #2c2d30 Background color of active items --double-select-item-color-active#191919 #efefef Text color of active items --double-select-item-background-hover#e6e6e6 #2c2d30 Background color of items on hover --double-select-item-color-hover#191919 #efefef Text color of items on hover
/* Custom styling for double select box */
--double-select-border-radius : 8 px ;
--double-select-border-color : #2196F3 ;
--double-select-item-background-active : #e3f2fd ;
--double-select-item-color-active : #0d47a1 ;
.double-select-box - The main container class for the component (automatically added)
Classes specified in the component parameters can be used to customize specific elements
Items can be moved between lists by:
Double-clicking on an item
Selecting an item and clicking the move buttons
Using the “move all” buttons to transfer all items at once
The component automatically creates the necessary UI elements (buttons, lists) based on the provided select elements
Items can include icons or custom HTML templates using data attributes
The component adapts to both light and dark themes
// Initialize a double select box programmatically
Metro . makePlugin ( '#myElement' , 'double-select-box' , {
// Get a reference to an existing double select box
const doubleSelectBox = Metro . getPlugin ( '#myDoubleSelectBox' , 'double-select-box' );