1.0.0 • Published 6 months ago
@khobie-maseko/dropdown-package v1.0.0
Dropdown Package
A simple, reusable dropdown menu component with zero dependencies.
Features
- Simple click-to-toggle functionality
 - Lightweight (under 2KB minified)
 - Easy to customize with your own CSS
 - Supports multiple dropdowns on the same page
 - Works with both CommonJS and ES modules
 
Installation
npm install @khobie-maseko/dropdown-packageUsage
- Include the CSS in your project:
 
<link rel="stylesheet" href="node_modules/@khobie-maseko/dropdown-package/dropdown.css">- Add the HTML structure:
 
<div class="dropdown">
  <button class="dropdown-toggle">Menu</button>
  <div class="dropdown-content">
    <a href="#">Item 1</a>
    <a href="#">Item 2</a>
    <a href="#">Item 3</a>
  </div>
</div>- Initialize the dropdown:
 
const { initDropdowns } = require('@khobie-maseko/dropdown-package');
// or if using ES modules:
// import { initDropdowns } from '@khobie-maseko/dropdown-package';
initDropdowns();API
initDropdowns(selector = '.dropdown')
Initializes all dropdowns matching the given selector.
Dropdown class
The underlying class that powers the dropdown functionality.
1.0.0
6 months ago