Socket
Socket
Sign inDemoInstall

@woftis/reusable-drop-down

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @woftis/reusable-drop-down

## Overview


Version published
Weekly downloads
0
Maintainers
1
Install size
3.42 kB
Created
Weekly downloads
 

Readme

Source

Reusable Dropdown

Overview

Small project as part of Odin Project curriculum to ceate a dropdown button that can be re-used across projets.

The code creates the necessary styles for showing and displaying the dropdown content and appends it to the HTML document as a style. This removes the need for anyone using the component to add specific style to show or hide.

Additional styling is not applied as it is assumed anyone using the component will want to apply their own styling.

Usage

  1. Install the package in project: npm install @woftis/reusable-drop-down --save
  2. Import the package in your JS file: import initaliseDropdown from "@woftis/reusable-drop-down";
  3. Initialise by calling initialiseDropdown();

In order to use the component create a button with a class of dropdown-btn immediately proceeded by a div with a class of dropdown-container. The div will then contain any drop down content.

Example:

    <button class="dropdown-btn" type="button">Click me</button>
    <div class="dropdown-container">
        <li>Option 1</li>
        <li>Option 2</li>
        <li>Option 3</li>
    </div>
  • Note that the code creates event listeners, so if dropdowns are being created dynamically, the initialiseDropdown function should be called after any components are dynamically created.

FAQs

Last updated on 23 Nov 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc