react-dropdown-cs
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Getting started

Compatibility

Your project needs to use React 16.8 or later.

Installation

Add react-dropdown to your project by executing npm install react-dropdown-cs or yarn add react-dropdown-cs.

Usage

Here's an example of basic usage:

import { useState } from 'react';
import "react-dropdown-cs/dist/dropdown.css";
import Dropdown from 'react-dropdown-cs';

function MyApp() {
   const [selectedOption, setSelectedOption] = useState(null);
  const icons = {
    "Dashboard": <FaTachometerAlt />,
    "User Settings": <FaCog />,
    "Notifications": <FaBell />,
    "Profile": <FaUser />,
    "Log Out": <FaSignOutAlt />,
    "None": <FaTimes />
  };

  return (
    <div>
          <Dropdown 
        options={["Dashboard", "User Settings", "Notifications", "Profile", "Log Out",]}
        selected={selectedOption}
        onSelect={setSelectedOption}
        placeholder="Choose an option"
        icons={icons}
      />
    </div>
  );
}

License

The MIT License.

Thank you

Package Sidebar

Install

npm i react-dropdown-cs

Weekly Downloads

2

Version

1.0.8

License

MIT

Unpacked Size

11.5 kB

Total Files

6

Last publish

Collaborators

  • ayush123123