# Dropdown

## CSS

Include the SCSS in your application

```scss
// Pick ONE of the files below depending on your theme to include
@import '@springernature/dropdown/';
@import '@springernature/dropdown/nature';
```

## 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 'dropdown/js';

dropdown();
```

The component uses the Expander from the `themes` 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/elements/blob/master/themes/springernature/js/README.md#expander).

