Multiselect

Multiselect

Angular Bootstrap Multiselect is a form control, that after the click displays a collapsable list of multiple values which can be used in forms, menus or surveys.

Multiselect enables you to use ↑ and ↓ arrow keys to navigate through options and use ↵ key to select required option.

Basic Multiselect

image info

html
<CDBMultiselect [options]='option' selected="Value"></CDBMultiselect>
typescript
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-multiselect',
templateUrl: './multiselect.component.html',
styleUrls: ['./multiselect.component.scss'],
})
export class MultiselectComponent implements OnInit {
option = [
{
text: 'Value 1',
showing: true,
},
{
text: 'Second Value',
showing: true,
},
{
text: 'Third Value',
showing: true,
},
{
text: 'Final Value',
showing: true,
},
];
selectOptions = [
{
text: 'Value 1',
showing: true,
},
{
text: 'Second Value',
showing: true,
},
{
text: 'Third Value',
showing: true,
},
{
text: 'Final Value',
showing: true,
},
];
constructor() {}
ngOnInit(): void {}
}

Multiselect with Search

image info

html
<CDBMultiselect color="secondary" [search]=true [options]='option' selected="Value"></CDBMultiselect>
typescript
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-multiselect',
templateUrl: './multiselect.component.html',
styleUrls: ['./multiselect.component.scss'],
})
export class MultiselectComponent implements OnInit {
option = [
{
text: 'Value 1',
showing: true,
},
{
text: 'Second Value',
showing: true,
},
{
text: 'Third Value',
showing: true,
},
{
text: 'Final Value',
showing: true,
},
];
selectOptions = [
{
text: 'Value 1',
showing: true,
},
{
text: 'Second Value',
showing: true,
},
{
text: 'Third Value',
showing: true,
},
{
text: 'Final Value',
showing: true,
},
];
constructor() {}
ngOnInit(): void {}
}

Multiselect with Submit Option

image info

html
<CDBMultiselect color="dark" [submit]=true [options]='option' selected="Value" ></CDBMultiselect>
typescript
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-multiselect',
templateUrl: './multiselect.component.html',
styleUrls: ['./multiselect.component.scss'],
})
export class MultiselectComponent implements OnInit {
option = [
{
text: 'Value 1',
showing: true,
},
{
text: 'Second Value',
showing: true,
},
{
text: 'Third Value',
showing: true,
},
{
text: 'Final Value',
showing: true,
},
];
selectOptions = [
{
text: 'Value 1',
showing: true,
},
{
text: 'Second Value',
showing: true,
},
{
text: 'Third Value',
showing: true,
},
{
text: 'Final Value',
showing: true,
},
];
constructor() {}
ngOnInit(): void {}
}

Multiselect with Limited Options

image info

html
<CDBMultiselect color="danger" [limitedOptions]=true [options]='option' selected="Value" ></CDBMultiselect>
typescript
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-multiselect',
templateUrl: './multiselect.component.html',
styleUrls: ['./multiselect.component.scss'],
})
export class MultiselectComponent implements OnInit {
option = [
{
text: 'Value 1',
showing: true,
},
{
text: 'Second Value',
showing: true,
},
{
text: 'Third Value',
showing: true,
},
{
text: 'Final Value',
showing: true,
},
];
selectOptions = [
{
text: 'Value 1',
showing: true,
},
{
text: 'Second Value',
showing: true,
},
{
text: 'Third Value',
showing: true,
},
{
text: 'Final Value',
showing: true,
},
];
constructor() {}
ngOnInit(): void {}
}

API

Here in this section you will find information about required modules and available inputs, outputs, methods and events of this component.

Contrast Multiselect Bootstrap Modules used

import {MultiselectModule } from 'cdbangular';

API Reference: Contrast Multiselect Inputs

The table below shows the possible input of the Multiselect component.

NameTypeDefaultDescriptionExample
classStringAdds custom classesclass="myClass"
searchBooleanfalseSearch element will appear as the first child of select.search=true
colorStringprimarySets colorful hover effect on select options.color="secondary"
optionsarray of objectsSets options array as source of data. This property is used in alternative Select version.[options]='option'
selectedStringSet default select text content.selected="choose_option"