@ec-europa/ecl-expandables

0.11.0 • Public • Published

Expandables

When and how to use this component

If you need to present a lot of content on a page, it can be divided into sub-sections in a structured way.

When to use this component

  • when you have a large amount of information

Do not use this component

  • as a rule avoid hiding information as much as possible

Implementation

In order to automatically attach event listeners on your expandables, add the following script to your page:

document.addEventListener('DOMContentLoaded', function() {
  ECL.initExpandables();
});

Change button label when the component is collapsed/expanded

You can attach data-label-expanded and data-label-collapsed attributes to your button. The button label will be updated dynamically according to these values. Check the first example for more information.

Resources

/@ec-europa/ecl-expandables/

    Package Sidebar

    Install

    npm i @ec-europa/ecl-expandables

    Weekly Downloads

    13

    Version

    0.11.0

    License

    EUPL-1.1

    Unpacked Size

    6.23 kB

    Total Files

    7

    Last publish

    Collaborators

    • kalin.chernev
    • weslito
    • yhuard