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

react-dropdown-toolkit

v0.0.10

Published

A searchable dropdown component for React with multiple selection and customizable styles.

Downloads

38

Readme

React Dropdown Toolkit

npm version codecov Codacy Badge License: ISC

A customizable and searchable dropdown component for ReactJS.

See it in action (Demo)

Features

  • Search functionality
  • Supports single and multiple selection
  • Option to render in a portal

Installation

Install the package via npm or yarn:

npm install react-dropdown-toolkit
or
yarn add react-dropdown-toolkit

Usage

Here's a basic example of how to use the Dropdown component:

import React from 'react';

import Dropdown from 'react-dropdown-toolkit';
import 'react-dropdown-toolkit/dist/index.css';

const options = [
  { label: 'Option 1', value: 'option1' },
  { label: 'Option 2', value: 'option2' },
  { label: 'Option 3', value: 'option3' },
];

const App = () => {
  return (
    <div>
      <h1>Dropdown Example</h1>
      <Dropdown options={options} label="Select an option" />
    </div>
  );
};

export default App;

Props

Dropdown

| Prop | Type | Default | Description | | ------------------ | ------------------------------------------------------------- | --------- | ---------------------------------------------- | | options | { label: string, value: string }[] | [] | The options to display in the dropdown | | multiple | boolean | false | Allows multiple selection | | withSearch | boolean | true | Enables search functionality | | onSelectedChange | ((selected: string[]) => void | undefined | Capture selected values in array format | | portal | boolean | false | Renders dropdown in a portal | | outlined | boolean | true | Adds an outline to the dropdown | | customRenderOption | (option: { label: string, value: string }) => React.ReactNode | null | Custom function to render an option | | zIndex | number | 1000 | The z-index of the dropdown menu | | label | string | "Label" | The label for the dropdown | | noLabel | boolean | false | To hide labels | | labelWidth | string | "250px" | Set the label width and adjust it to your form | | labelPosition | string | "left" | Displays label position | | labelStyle | {} | {} | Custom label style |

Development

To run the project locally for development:

Clone the repository:

git clone https://github.com/wisnuvb/react-dropdown-toolkit.git
cd react-dropdown-toolkit

Install dependencies:

npm run install
or
yarn install

Build the project:

npm run build
or
yarn build

Run tests:

npm run test
or
yarn test

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the ISC License.