0.0.10 • Published 12 months ago

react-dropdown-toolkit v0.0.10

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

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

PropTypeDefaultDescription
options{ label: string, value: string }[][]The options to display in the dropdown
multiplebooleanfalseAllows multiple selection
withSearchbooleantrueEnables search functionality
onSelectedChange((selected: string[]) => voidundefinedCapture selected values in array format
portalbooleanfalseRenders dropdown in a portal
outlinedbooleantrueAdds an outline to the dropdown
customRenderOption(option: { label: string, value: string }) => React.ReactNodenullCustom function to render an option
zIndexnumber1000The z-index of the dropdown menu
labelstring"Label"The label for the dropdown
noLabelbooleanfalseTo hide labels
labelWidthstring"250px"Set the label width and adjust it to your form
labelPositionstring"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.

0.0.10

12 months ago

0.0.9

12 months ago

0.0.8

12 months ago

0.0.7

12 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago