Socket
Socket
Sign inDemoInstall

@springernature/global-dropdown

Package Overview
Dependencies
1
Maintainers
13
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @springernature/global-dropdown

Display a contextual list of links controlled by a toggle


Version published
Maintainers
13
Created

Readme

Source

Global Dropdown

Global branded dropdown

CSS

Include the SCSS in your application

// Pick ONE of the brands below to include
@import '@springernature/global-dropdown/scss/10-settings/default';
@import '@springernature/global-dropdown/scss/10-settings/nature';

// Include this with your other components
@import '@springernature/global-dropdown/scss/50-components/dropdown';

Example usage

The core experience will show a label and a list of items underneath. JavaScript and more advanced CSS options are available by using the class .js on the document root element.

<div class="c-dropdown">
    <span class="c-dropdown__label">dropdown</span>
    <button class="c-dropdown__button" aria-expanded="false" data-dropdown>Dropdown
        <svg aria-hidden="true" width="10" height="10" aria-hidden="true" focusable="false">
            <use xlink:href="i-chevron-more"></use>
        </svg>
    </button>
    <ul class="c-dropdown__menu">
        <li><a href="#" class="c-dropdown__link" data-dropdown-item>Option 1</a></li>
        <li><a href="#" class="c-dropdown__link" data-dropdown-item>Option 2</a></li>
        <li><a href="#" class="c-dropdown__link" data-dropdown-item>Option 3</a></li>
    </ul>
</div>

Enhanced dropdown

init(dropdownSelector = '[data-dropdown]', itemSelector = '[data-dropdown-item]') 

By default the component relies on a data-dropdown and data-dropdown-item HTML attributes. These can be overwritten in the init function.

The first argument is a CSS selector to target the dropdown button. The second argument is a CSS selector to target items inside the list.

FAQs

Last updated on 04 Nov 2021

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