react-menubar-cs
Version:
An menubar component.
80 lines (65 loc) • 1.73 kB
Markdown
## Getting started
### Compatibility
Your project needs to use React 16.8 or later.
### Installation
Add react-menubar to your project by executing npm install react-menubar-cs or yarn add react-menubar-cs.
### Usage
Here's an example of basic usage:
```tsx
import { useNavigate } from 'react-router-dom';
import Menubar from 'react-menubar-cs';
import "react-menubar-cs/dist/menubar.css";
function MyApp() {
const navigate = useNavigate();
const handleMenuClick = (path) => {
if (path) {
navigate(path);
}
};
const menuData = [
{
name: "Appliances",
icon: <FaUtensils />,
subMenu: [
{
name: "Kitchen",
subMenu: [
{ name: "Electric Cookers" },
{ name: "Coffee Makers", path: "/cart" },
{ name: "Blenders" },
],
},
{
name: "Air Conditioners",
subMenu: [
{ name: "Inverter ACs", icon: <FaSnowflake />, },
{ name: "Split ACs", path: "/gst" },
{ name: "Window ACs" },
],
},
{ name: "Washing Machine" },
],
},
{ name: "Accessories", icon: <FaTshirt /> },
{ name: "Fashion", path: "/message" },
{ name: "Home & Living", icon: <FaCouch /> },
{ name: "Home", icon: <FaHome /> },
];
return (
<div>
<Menubar
menuData={menuData}
textColor="white"
bgColor="#222"
hoverColor="#FFD700"
dropdownBgColor="#333"
dropdownTextColor="white"
onMenuClick={handleMenuClick}
/>;
</div>
);
}
```
## License
The MIT License.
## Thank you