@jackob2004/dropdown
v1.0.14
Published
Simple dropdown component with one theme included. Part of the Odin Project
Readme
@jackob2004/dropdown
A simple, dropdown component with a built-in theme. No dependencies required. Part of The Odin Project.
Installation
npm install @jackob2004/dropdownUsage
1. Import the JavaScript and CSS
import '@jackob2004/dropdown/src';
import '@jackob2004/dropdown/src/dropdown-theme.css'; // Optional: for default styling2. Add HTML markup
<div class="dropdown">
<button class="dropdown-btn" type="button" data-toggle="dropdown">
Dropdown button
</button>
<ul class="dropdown-content">
<li class="dropdown-item"><a href="#">Link 1</a></li>
<li class="dropdown-item"><a href="#">Link 2</a></li>
<li class="dropdown-item"><a href="#">Link 3</a></li>
</ul>
</div>HTML Structure Requirements
- The button must have
data-toggle="dropdown"attribute - The dropdown content must have the class
dropdown-content - The button and content must have the same parent with
dropdownclass
License
ISC
Author
Created by @jackob2004
