@baptistej/react-dropdown

React Dropdown Component Library

A simple, customizable and accessible React dropdown component

Links

Installation

npm install --save "@baptistej/react-dropdown";

or :

yarn add "@baptistej/react-dropdown";

Usage

Import the component and style and use it in your code :

import Dropdown from "@baptistej/react-dropdown";
import "@baptistej/react-dropdown/dist/style.css";
const App = () => {
return (
<Dropdown />
);
}
export default App;

Props

Prop nameTypeDefaultDescription
dataarray["Option 1", "Option 2", "Option 3"]Array of options
enableDefaultClassNameboolean

true

Enable default class names from the library. Toggle between true and false.
idstring

""

Id of the dropdown (for accessibility)
onSelectedfunction

{}

Function called when an option is selected.
placeholderstring"Select an option..."Placeholder text
resetboolean

false

Reset the dropdown to default value. Toggle between true and false.
stylesobject

{}

Inline styles (refer to css styles)
themestring"light"Theme of the dropdown

Examples

Contributors

Baptiste JAN - https://github.com/BaptisteJ24