@shazomiii/simple-dropdown
v1.0.1
Published
A simple dropdown menu.
Readme
Simple Dropdown Menu
A lightweight and simple dropdown menu component.
Installation
npm install @shazomiii/simple-dropdownUsage
- Create a container element in your HTML.
<div id="my-dropdown"></div>- Import the
createDropdownfunction in your JavaScript and call it.
import { createDropdown } from '@shazomiii/simple-dropdown';
// The selector for your container element
const containerSelector = '#my-dropdown';
// The text for the dropdown button
const buttonText = 'Click Me';
// An array of objects for the menu items
const menuItems = [
{ title: 'Home', href: '/home' },
{ title: 'About', href: '/about' },
{ title: 'Contact', href: '/contact' }
];
// Initialize the dropdown
createDropdown(containerSelector, buttonText, menuItems);