Your project needs to use React 16.8 or later.
Add react-dropdown to your project by executing npm install react-dropdown-cs or yarn add react-dropdown-cs.
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>
);
}
The MIT License.