Windframe Import update is finally here!

How to create a beautiful React Bootstrap select with icons.


By Emmanuel Chinonso

Web Developer

How to create beautiful React Bootstrap select with icons.

The React Bootstrap Select component is a form control that displays a collapsible list of multiple values, which can be used in forms, menus or surveys after the click.

Select enables you to use ↑ and ↓ arrow keys to navigate through options and use the key to select the required option (works for stateful select). We are going to look at how to create a select using Contrast.

Contrast, also known as CDBReact is a react library which is an Elegant UI kit with full bootstrap support that has reusable components for building mobile-first, responsive websites and web apps.


The react Bootstrap Select would be built using React, Bootstrap, and CDBReact. You don’t need to have any previous knowledge of CDBReact, but the following are necessary:

  • JavaScript Knowledge
  • Basic React Knowledge
  • Basic Bootstrap knowledge
  • NPM installed

The select page with the icon we are going to build looks like the image below React Bootstrap Select


First, Check that you have node installed. To do this, run the following command in your terminal.



This should show you the current version of node you have installed on your machine. If you don’t have nodejs installed, download it here. Installing node also installs npm on your PC, but you can still confirm using npm-v. Now that we have node installed, we can start up our React project by going to the directory of our choice and running.


npx create-react-app select-app

I named the project select-app, but you can use whatever name of your choice.

Select with icon

In the future, we need to create a file named select.js which would contain our select component. Then, we can Import the select component that we’ll be using. It is important you download the pro version of contrast to use the select with icons.

Installing CDBReact-pro

Before we install our CDBReact we have to download the pro version here first. Then, we can go ahead to install them in our project. It is advised to add the file to the root of the project by running:

npm install --save ./path-to-the-cdbreact-pro-tgz-file

Or using Yarn

yarn add ./path-to-the-cdbreact-pro-tgz-file

Note that we don’t need to install bootstrap or add it anywhere in our project as CDBReact does that for us upon installation.


import React, { useState } from 'react';
import { CDBSelect, CDBContainer } from 'cdbreact-pro';

Here, we imported the useState from react, including CDBSelect and CDBContainer from contrast. We can now create the select with icons and add styling to them according to our preference. To use the react bootstrap select with icons, you need to download the pro version of contrast.


export const Select = () => {
const [option] = useState([
text: 'Select Option',
icon: 'stack-overflow',
text: 'Another Option',
icon: 'reddit',
text: 'Option 3',
icon: 'instagram',
text: 'Option 4',
text: 'Last Option',
return (
<CDBSelect2 options={option} iconBrand selected="Choose an option" color="white" />
export default Select;

In the above code, the select component is created in the above code, and the various styles and icons are added. Let us import the created select component into our app component


import './App.css';
import Select from './select';
import Reactdom from 'react-dom';
function App() {
return (
<div className="App">
<Select />
Reactdom.render(<App />, document.getElementById('root'));

Our page should look like this React Bootstrap Select

A React Bootstrap select using contrast is quite simple to build and allows you to use several tools, including bootstrap styling without installing bootstrap to create your select with icons.


CDBReact Select Docs

Link to code on github

Get Contrast Pro

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


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

Related Posts