11> Single/Multi Select React Component
22
3- Inspired by [ React MultiSelect] ( https://github.com/Khan/react-multi-select )
4-
53[ Demo and Specimens] ( https://darianstlex.github.io/react-sm-select ) Catalog
64
75### Installation
86
9- Install the react-sm-select npm package:
10-
117``` code
128npm install react-sm-select
139```
@@ -47,10 +43,12 @@ Can be used css overriding, see compiled css. Or use scss variables for general
4743
4844$SM-white: #fff;
4945$SM-brightGrey: #ebf5ff;
46+ $SM-smoothGray: #f3f3f3;
5047$SM-lightGrey: #cfd4d9;
5148$SM-lightBlue: #1298d4;
5249$SM-grey: #949ca6;
5350$SM-darkBlue: #143154;
51+ $SM-shadowBlue: rgba(18,152,212,0.5);
5452
5553// General Colors
5654$SM-backgroundColor: $SM-white;
@@ -60,6 +58,7 @@ $SM-borderColor: $SM-grey;
6058$SM-textColor: $SM-darkBlue;
6159
6260// Value Colors
61+ $SM-headerSelectedColor: $SM-shadowBlue;
6362$SM-valueColor: $SM-textColor;
6463$SM-valuePlaceholderColor: $SM-mutedColor;
6564
@@ -71,15 +70,18 @@ $SM-tagCloseColor: $SM-textColor;
7170$SM-tagCloseBackgroundColor: $SM-lightGrey;
7271
7372// DropDown
74- $SM-dropDownArrowColor: $SM-grey ;
73+ $SM-dropDownArrowColor: $SM-mutedColor ;
7574$SM-dropDownActiveArrowColor: $SM-lightBlue;
7675
7776// Search Colors
77+ $SM-searchTextColor: $SM-textColor;
7878$SM-searchPlaceholderColor: $SM-mutedColor;
79+ $SM-searchSelectedColor: $SM-shadowBlue;
7980
8081// Option Colors
8182$SM-itemTextColor: $SM-textColor;
8283$SM-itemBackgroundHoverColor: $SM-brightGrey;
84+ $SM-itemBackgroundFocusColor: $SM-smoothGray;
8385$SM-dividerColor: $SM-lightGrey;
8486$SM-selectAllColor: $SM-itemTextColor;
8587
@@ -212,47 +214,47 @@ filterOptions(options, text) {
212214
213215---
214216
215- - ** ` ArrowRenderer : function` ** DropDown Arrow:
217+ - ** ` Arrow : function` ** DropDown Arrow:
216218
217219``` code
218- ArrowRenderer ({options, value, expanded, hasFocus}) {
220+ Arrow ({options, value, expanded, hasFocus, disabled }) {
219221 // options: array - see 'options' prop
220222 // value: array - see 'value' property
221223 // expanded: boolean - expanded component status
222224 // hasFocus: boolean - hasFocus component status
225+ // disabled: boolean - disabled component status
223226
224227 return - component to render custom Arrow
225228}
226229```
227230
228231
229- - ** ` LoadingRenderer : function` ** Loading Indicator:
232+ - ** ` Loading : function` ** Loading Indicator:
230233
231234``` code
232- LoadingRenderer () {
235+ Loading () {
233236 return - component to render custom Loading Indicator
234237}
235238```
236239
237240
238- - ** ` OptionRenderer : function` ** Option:
241+ - ** ` Option : function` ** Option:
239242
240243``` code
241- OptionRenderer({option, checked, disabled, onClick }) {
244+ Option({ checked, option, isSingle }) {
242245 // option: object - from options props: { value, label }
243246 // checked: boolean - define if option is checked
244- // disabled: boolean - disable option if component is disabled
245- // onClick: function - notifies component about option click
247+ // isSingle: boolean - single selection mode
246248
247249 return - component to render custom Option
248250}
249251```
250252
251253
252- - ** ` TagRenderer : function` ** Tag:
254+ - ** ` Tag : function` ** Tag:
253255
254256``` code
255- TagRenderer ({label, index, removableTag, onTagRemove}) {
257+ Tag ({label, index, removableTag, onTagRemove}) {
256258 // label: string - tag label
257259 // index: number - tag index in array used in removal
258260 // removableTag: boolean - display/hide remove tag button
@@ -261,10 +263,10 @@ TagRenderer({label, index, removableTag, onTagRemove}) {
261263```
262264
263265
264- - ** ` ValueRenderer : function` ** Value:
266+ - ** ` Value : function` ** Value:
265267
266268``` code
267- ValueRenderer ({value, options}) {
269+ Value ({value, options}) {
268270 // options: array - see 'options' property
269271 // value: array - see 'value' property
270272
0 commit comments