0.0.116 • Published 1 year ago

dynamic-react-select v0.0.116

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Dynamic React Select

A react application

Usage

To use the dynamic-react-select component, follow these steps:

  1. Install the package using npm or yarn: npm:

    npm install dynamic-react-select

    yarn:

    yarn add dynamic-react-select

    pnpm:

    pnpm add dynamic-react-select
  2. Import the component in your project:

    import DynamicReactSelect from 'dynamic-react-select'
  3. Use the component in your code:

    const options = [
      { value: 'option1', label: 'Option 1' },
      { value: 'option2', label: 'Option 2' },
      { value: 'option3', label: 'Option 3' },
    ]
    
    const MyComponent = () => {
      return (
        <div>
          <h1>My Component</h1>
          <DynamicReactSelect name='field-name' options={options} />
        </div>
      )
    }
    
    export default MyComponent
  4. Customize the component by passing props as needed.

That's it! You can now use the DynamicReactSelect component in your project. Feel free to explore the available props and customize it according to your requirements.

Props

Prop NameDefaultRequiredDescription
optionsEmpty Array[] {value: string, label: string}>trueList of elements to rendering
valuenullfalseItem of the list {value: string, label: string} or null
nameundefinedtrueField name
onChangeundefinedfalseTriggered function when is item from the list is selected
onInputChangeundefinedfalseTriggered function when the input for search changes
isSearchablefalsefalseFlag to show or not the search input field
isLoadingfalsefalseFlag to display a status loading with loadingLabel prop
clearValueOnSelectfalsefalseFlag that allow to clear the selection, selecting the selected item from the list
onReachThresholdfunction voidfalsetriggered function when item from the threshold config enters the view
threshold3falseIndex of the item from the bottom of the list that is being watched when is in or out the view
asyncfalsefalseIf true, it calls onInputChange when the search input changes; if false, it calls a local function that filters the list of options.
classes{  root: ''   select: ''   input: ''   list: ''   listItem: ''   listItemActive: '' }falseStyles class for the different components within
loadingLabel'loading'falseCustom text displayed when component status 'loading = true'
placeholder'Select one'falseCustom text displayed when is no item selected
0.0.116

1 year ago

0.0.115

1 year ago

0.0.114

1 year ago

0.0.113

1 year ago

0.0.112

1 year ago

0.0.111

1 year ago

0.0.110

1 year ago

0.0.106

1 year ago

0.0.109

1 year ago

0.0.108

1 year ago

0.0.107

1 year ago

0.0.105

1 year ago

0.0.104

1 year ago

0.0.103

1 year ago

0.0.99

1 year ago

0.0.102

1 year ago

0.0.101

1 year ago

0.0.100

1 year ago

0.0.95

1 year ago

0.0.96

1 year ago

0.0.97

1 year ago

0.0.98

1 year ago

0.0.94

1 year ago

0.0.93

1 year ago

0.0.92

1 year ago

0.0.91

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago