🤩
Windframe Import Update is finally here.

Multiselect

React Bootstrap 5 Multiselect

React Bootstrap 5 Multiselect is a form control that displays a collapsible list of numerous values after the user clicks it. It's appropriate for usage in forms, menus, and surveys. They let you to move through alternatives with the and arrow keys, and choose the required option using the key.

Importing the React Bootstrap 5 Multiselect Component

Begin by importing 'CDBMultiselect' into your project to use the Contrast React Bootstrap 5 Multiselect component.

js
import { CDBMultiselect } from "cdbreact";

Default Multiselect

Pro Component

The options argument in the React Bootstrap 5 Multiselect Component accepts an object reflecting a user's multiple choices.

Contrast React Bootstrap 5 Default Multiselect Component
js
import React from "react";
import { CDBMultiselect, CDBContainer } from "cdbreact";
export const Multiselect = () => {
// "showing" key:value pair optional
const option = [
{
text: "Value 1",
showing: true,
},
{
text: "Second Value",
showing: true,
},
{
text: "Third Value",
showing: true,
},
{
text: "Final Value",
showing: true,
},
];
return (
<CDBContainer>
<CDBMultiselect options={option} selected="Value" />
</CDBContainer>
);
};

Multiselect with Search

To enable users to search for these choices, use the search options parameter.

Pro ComponentContrast React Bootstrap 5 Multiselect with Search Component
js
import React from "react";
import { CDBMultiselect, CDBContainer } from "cdbreact";
export const Multiselect = () => {
// "showing" key:value pair optional
const option = [
{
text: "Value 1",
showing: true,
},
{
text: "Second Value",
showing: true,
},
{
text: "Third Value",
showing: true,
},
{
text: "Final Value",
showing: true,
},
];
return (
<CDBContainer>
<CDBMultiselect color="secondary" search options={option} selected="Value" />
</CDBContainer>
);
};

Multiselect with Submit Option

Pro ComponentContrast React Bootstrap 5 Multiselect with Submit Option Component
js
import React from "react";
import { CDBMultiselect, CDBContainer } from "cdbreact";
export const Multiselect = () => {
// "showing" key:value pair optional
const option = [
{
text: "Value 1",
showing: true,
},
{
text: "Second Value",
showing: true,
},
{
text: "Third Value",
showing: true,
},
{
text: "Final Value",
showing: true,
},
];
return (
<CDBContainer>
<CDBMultiselect color="dark" submit options={option} selected="Value" />
</CDBContainer>
);
};

Multiselect with Limited Options

Pro ComponentReact Bootstrap 5 Multiselect with Limited Option Component
js
import React from "react";
import { CDBMultiselect, CDBContainer } from "cdbreact";
export const Multiselect = () => {
// "showing" key:value pair optional
const option = [
{
text: "Value 1",
showing: true,
},
{
text: "Second Value",
showing: true,
},
{
text: "Third Value",
showing: true,
},
{
text: "Final Value",
showing: true,
},
];
return (
<CDBContainer>
<CDBMultiselect color="danger" limitedOptions options={option} selected="Value" />
</CDBContainer>
);
};

Contrast React Bootstrap 5 Multiselect Props

The props you get to use with the React Bootstrap 5 Multiselect component will be expanded upon in this section. You'll learn what these props do, how to utilize them in your code, and what their default values are.

Other CDBMultiselect component prop options are listed in the table below.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classesAdds custom classes<CDBMultiselect className="myClass" ... />
tagStringdivChanges default tag<CDBMultiselect tag="div" ... />
searchBooleanfalseSearch element will appear as the first child of select.<CDBMultiselect search .../>
colorStringprimarySets colorful hover effect on select options.<CDBMultiselect color="secondary" ... />
optionsarray of objectsSets options array as source of data. This property is used in alternative Select version.<CDBMultiselect options={option} ... />
selectedStringSet default select text content.<CDBMultiselect selected="choose_option" ... />

Trying to build out all user interfaces and components for your website or web app from scratch can become a very tedious task. A huge reason why we created Contrast Bootstrap to help reduce the amount of time we spend doing that, so we can focus on building some other aspects of the project. Contrast Bootstrap PRO consists of a UI Kit featuring over 10000+ component variants. Together with a template of 5 admin dashboards and 23+ additional multipurpose pages template for building almost any type of website or web app. You can view a demo and learn more about Contrast by clicking here.Download the free react template

ad-banner

Contrast Bootstrap PRO was built using the most popular CSS framework Bootstrap to help build your next landing, admin SAAS, prelaunch etc project with a clean, prebuilt and well documented template and UI components.Learn more about Contrast