# @springernature/global-dropdown

> Display a contextual list of links controlled by a toggle

Latest version **5.0.0** (published 2023-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @springernature/global-dropdown
pnpm add @springernature/global-dropdown
yarn add @springernature/global-dropdown
bun add @springernature/global-dropdown
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2023-01-30 |
| First published | 2018-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 35.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Springer Nature |
| Maintainers | roshandeorukhkar-sn, benjclark, sonniesedge, rlau, dotcode, joseluisbolos, hollsk, moddular, jpw, nickcall, howlingmad, sndigital, davidpauljunior, morgaan |

## Links

- npm: https://www.npmjs.com/package/@springernature/global-dropdown
- npm.io page: https://npm.io/package/@springernature/global-dropdown

## Recent versions

- 5.0.0 (latest) — 2023-01-30
- 4.1.1 — 2022-09-21
- 4.1.0 — 2022-07-29
- 4.0.0 — 2022-04-12
- 3.0.2 — 2022-02-18
- 3.0.1 — 2022-01-13
- 3.0.0 — 2021-12-03
- 2.0.1 — 2021-11-15
- 2.0.0 — 2021-11-09
- 1.1.0 — 2021-11-04
- 1.0.0 — 2021-10-28
- 0.5.0 — 2021-10-26
- 0.4.0 — 2021-10-25
- 0.3.0 — 2018-10-09
- 0.2.0 — 2018-08-23
- … 1 more at https://npm.io/package/@springernature/global-dropdown/versions

## README

# Global Dropdown

Global branded dropdown

## CSS

Include the SCSS in your application

```scss
// 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.

```html
<div class="c-dropdown">
    <span class="c-dropdown__label">dropdown</span>
    <button class="c-dropdown__button" aria-expanded="false" data-dropdown data-dropdown-target="#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" id="#dropdown">
        <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

```javascript
import {dropdown} from 'global-dropdown/js';

dropdown();
```

The component uses the Expander from the `brand-context` package to handle the events. 

You can get a quick implementation by adding these two attributes `data-dropdown` and `data-dropdown-target` in your HTML as shown at the example above.

If you need more flexibility, use the expander component directly following its [documentation](https://github.com/springernature/frontend-toolkits/blob/master/context/brand-context/default/js/README.md#expander).

---
_Source: https://npm.io/package/@springernature/global-dropdown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
