JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
</head>
<body>
<select class="js-example-basic-single" name="state">
<option value="1">Select Item 01</option>
<option value="2">Select Item 02</option>
<option value="3">Select Item 03</option>
<option value="4">Select Item 04</option>
<option value="5">Select Item 05</option>
<option value="6">Select Item 06</option>
<option value="7">Select Item 07</option>
<option value="8">Select Item 08</option>
</select>
</body>
</html>
CSS
:root {
--Color1: #3333FF;
--Color2: #FFFFFF;
--Color3: #EC2121;
--Color4: #000000;
--Color5: #AAAAAA;
--Color6: #F99320;
}
.js-example-basic-single {
width: 200px;
}
/* Search Box */
.select2-container--default .select2-search--dropdown .select2-search__field {
background: var(--Color4);
color: var(--Color2) !important;
}
/* Search Box border */
.select2-search--dropdown{
background: var(--Color6);
}
/* Selected / Initial state input */
.select2-container--default .select2-selection--single .select2-selection__rendered {
background: var(--Color1);
color: var(--Color2) !important;
}
/* Option List Area */
.select2-results__option {
background: var(--Color1);
color: var(--Color2) !important;
}
/* Arrow button */
.select2-container--default .select2-selection--single .select2-selection__arrow {
background: var(--Color3);
}
/* Selectable items highlight */
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
background: var(--Color3) !important;
}
/* Selected item highlight */
.select2-container--default .select2-results__option--selected {
background: var(--Color5) !important;
color: var(--color4) !important;
}
/* Search result message area */
.select2-results__message {
background: var(--Color6);
}
JavaScript
$('.js-example-basic-single').select2({
placeholder: 'Select an option'
});