Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-bootstrap-select-dropdown

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-bootstrap-select-dropdown

A custom Bootstrap select / multiselect using dropdown button, designed to behave like regular select form control. Bootstrap Select/Multiselect developed to use with **React 16+** and **Bootstrap 4**.

  • 1.3.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-bootstrap-select-dropdown

A custom Bootstrap select / multiselect using dropdown button, designed to behave like regular select form control. Bootstrap Select/Multiselect developed to use with React 16+ and Bootstrap 4.

Installation

npm i react-bootstrap-select-dropdown --save

Usage

Quick Usage

Import BootstrapSelect component

import BootstrapSelect from 'react-bootstrap-select-dropdown';

Use of component

<BootstrapSelect options={options} />

Required JSON to list {options}

"options": [
	{
		"labelKey": "optionItem1",
		"value": "Option item 1"
	},
	{
		"labelKey": "optionItem2",
		"value": "Option item 2"
	}
]

Use of callback function

const handleChange = (selectedOptions) => {
	console.log(selectedOptions);
}

<BootstrapSelect options={options} onChange={handleChange} />

Optional key support in {options} JSON

KeyTypeDefaultDescription
isSelectedbooleanIt is used to set option selected default on component load.
isDisabledbooleanIt is used to set option disabled and user will unable to select.
iconstringClass name of an icon to show before option text. You can define multiple classes with icon class.
classNamestringAdd custom class to each option
stylestyle JSONAdd custom style attr to each option
"options": [
	{
		"labelKey": "optionItem1",  // Required
		"value": "Option item 1", // Required
		"isSelected": true, // Optional
		"isDisabled": false,  // Optional
		"icon": "icon-class-name" //Optional
		"className": "custom-class-name" //Optional
		"style": { //Optional
			"backgroundColor":"#000000",
			"color": "#FFFFFF"
		}
	}
]

Props support in BootstrapSelect

PropTypeDefaultDescription
optionsarrayAn array of option's objects to list in dropdown menu
defaultOptionsarrayIt's allow to set default option(s) manually on load even if "isSelected" is not set in option's object. Array item(s) must contain value same as "labelKey" of options.
isMultiSelectbooleanfalseAllow to select multiple options.
showTickbooleanfalseTo display tick with option on select.
showSearchbooleanfalseAllow to search from options list.
showActionbooleanfalseEnable actions buttons select/deselect all options, will work only if isMultiSelect sets to true.
disabledbooleanfalseIt's allow you disable boostrap select on component load
selectStylestringbtn-lightApply custom style by using custom class or bootstrap btn style classes.
actionBtnStylestringbtn-outline-darkApply custom style to action buttons (select/deselect all) by using custom class or bootstrap btn style classes. Will work only if isMultiSelect sets to true.
menuSize'auto'/false/number'auto'Allows to set max. options to list with vertical scrollbar if many options.
showCountOnnumberShow selected options number as selected value in select.
classNamestringAdd classes to outer most tag.
placeholderstringNo option selectedSet custom placeholder if no option selected.
onChangefunctionAn onChange handler passed to the Toggle component
onClosefunctionAn onClose handler passed to the Toggle component

Dependencies

Make sure Bootstrap 4 is installed in you project or required to install it and css needs to imported in project:

Installation bootstrap

npm install bootstrap@4.6.0

Import bootstrap css

import 'bootstrap/dist/css/bootstrap.min.css';

Keywords

FAQs

Package last updated on 25 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc