npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dynamic-react-select

v0.0.105

Published

Simple dynamic react select

Downloads

1,220

Readme

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 Name | Default | Required | Description | | :--------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------ | | options | Empty Array[] {value: string, label: string}> | true | List of elements to rendering | | value | null | false | Item of the list {value: string, label: string} or null | | name | undefined | true | Field name | | onChange | undefined | false | Triggered function when is item from the list is selected | | onInputChange | undefined | false | Triggered function when the input for search changes | | isSearchable | false | false | Flag to show or not the search input field | | isLoading | false | false | Flag to display a status loading with loadingLabel prop | | clearValueOnSelect | false | false | Flag that allow to clear the selection, selecting the selected item from the list | | onReachThreshold | function void | false | triggered function when item from the threshold config enters the view | | threshold | 3 | false | Index of the item from the bottom of the list that is being watched when is in or out the view | | async | false | false | If 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: '' } | false | Styles class for the different components within | | loadingLabel | 'loading' | false | Custom text displayed when component status 'loading = true' | | placeholder | 'Select one' | false | Custom text displayed when is no item selected |