1.1.1 • Published 2 years ago

@bgryks/react-multiselect v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

react-multiselect

Multiselect component for reactjs.

Download

npm install @bgryks/react-multiselect

or

yarn add @bgryks/react-multiselect

import { Multiselect } from "@bgryks/react-multiselect"

Type

ChoiceItem

interface ChoiceItem {
 [value: string]: any;
}

MultiselectProps

interface MultiselectProps {
defaultOpen?: boolean;
optionId?: string;
optionText?: string;
disabledItem?: string;
suffix?: string;
disabled?: boolean;
loading?: boolean;
loadingIcon?: ReactElement;
inputProps?: React.DetailedHTMLProps<
React.InputHTMLAttributes<HTMLInputElement>,
HTMLInputElement>;
inputContainerClassName?: string;
choices?: ChoiceItem[];
defaultSelected?: string;
showStyle?: "items" | "numbers";
deleteIcon?: ReactElement;
clearIcon?: ReactElement;
menuUpIcon?: ReactElement;
menuDownIcon?: ReactElement;
noContentMessage?: string | ReactElement;
countForScrollFunction?: number;
showSelectedMessage?: (items: ChoiceItem[]) => string | ReactElement;
onSelectedsChange?: (items: ChoiceItem[]) => void;
onInputValChange?: (val: string) => void | string;
onScrollBottom?: (items: ChoiceItem[]) => void;
}

Props

NameTypeDescriptionDefault
choices?ChoiceItem[]List of choices.[]
clearIcon?ReactNodeButton to clear all items to the right of the input.<MenuTimes/>
defaultSelected?stringThe property name of initial chocies. If the value of the specified property is true, the item will be selected initially.default
disabled?booleanIf true, component is disabled.false
disabledItem?stringProperty name of the choices which will be disabled."disabled"
countForScrollFunction?numberA number that specifies how many item must be left in the result container after scrolling to work the process defined in the onScrollBottom method.3
inputContainerClassName?stringClassname of the div containing the input.""
inputProps?objectReact input props .{}
loading?booleanIf true, a loading icon will be displayed at the end of the input.false
loadingIcon?ReactElementAn React component for the loading state.<Loading/>
menuDownIcon?ReactElementAn React component for the menu down click button.<MenuDown/>
menuUpIcon?ReactNodeAn React component for the menu up click button.<MenuUp/>
noContentMessage?ReactElement | stringContent message telling users that the choices not found."No content"
onInputValChange?(val: string) => void | stringCallback function that runs when input value has been changed.undefined
onScrollBottom?(items: ChoiceItem[]) => voidCallback function that runs when scrolled to bottom.undefined
onSelectedsChange?(items: ChoiceItem[]) => voidCallback function that runs when state of selected items has changed.undefined
open?booleanIf true, the menu list container will initially be displayed.false
optionId?stringProperty name that specifies the unique value of the choices."id"
optionText?stringProperty name that specifies the text value of the choices."value"
deleteIcon?ReactElementDelete icon for each selected items.<MenuTimes/>
showSelectedMessage?(items: ChoiceItem[]) => string | ReactNodeMessage showing users selected items. It works if the showStyle property is "numbers".(items: ChoiceItem[]) => items.length + " items selected"
showStyle?"items" | "numbers"If "items", each item in the list will be displayed as a box in the container. If "numbers", only one box which containing message to show will be displayed"items"
suffix?stringClass suffix to separate elements used in the component. Example: react-multiselect-container-myclassname""

Custom Styling

ClassnameDescription
.react-multiselect-input-containerThe wrapper element containing input content and indicators in the component.
.react-multiselect-input-contentThe element containing the selected items and input element.
.react-multiselect-input-selected-itemSelected item boxes in the .react-multiselect-input-content.
.react-multiselect-input-textboxThe html input element in the .react-multiselect-input-content
.react-multiselect-result-containerThe container element of the result of choices.
.react-multiselect-result-itemResult items of the result container.
.react-multiselect-input-indicatorsThe container of the indicators containing times icon and menu icons.
1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago