### Start Website Development Server Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/docs/developers-start-here.md Starts the development server for the project's website. ```bash yarn start:website ``` -------------------------------- ### Install Gallery Component Source: https://context7.com/ec-europa/europa-component-library/llms.txt Install the Gallery component using npm. This component provides a lightbox-capable media gallery. ```bash npm install --save @ecl/twig-component-gallery ``` -------------------------------- ### Install Blockquote Component Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/implementations/twig/components/blockquote/README.md Install the blockquote component using npm. ```shell npm install --save @ecl/twig-component-blockquote ``` -------------------------------- ### Install Media Container Component Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/implementations/twig/components/media-container/README.md Install the media container component using npm. ```shell npm install --save @ecl/twig-component-media-container ``` -------------------------------- ### Display In-Page Navigation Example Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/website/src/pages/ec/components/navigation/inpage-navigation/docs/code.mdx Use the Playground component to render an example of the in-page navigation. This requires importing the Playground and Html components, as well as the specific markup for the in-page navigation example. ```javascript import { Playground, Html } from '@ecl/website-components'; import inpageNavigationExample from '../demo'; ``` -------------------------------- ### Install Social Media Follow Component Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/implementations/twig/components/social-media-follow/README.md Install the social media follow component using npm. ```shell npm install --save @ecl/twig-component-social-media-follow ``` -------------------------------- ### Install Preset with npm Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/README.md Install a specific ECL preset using npm. Ensure you have Node.js v20.9.0 or compatible. ```bash npm install @ecl/preset-ec ``` -------------------------------- ### Install ECL Inpage Navigation Component Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/implementations/twig/components/inpage-navigation/README.md Install the inpage-navigation component using npm. ```shell npm install --save @ecl/twig-component-inpage-navigation ``` -------------------------------- ### Install ECL File Upload Status Composition Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/implementations/twig/compositions/file-upload-status/README.md Install the package using npm. ```shell npm install --save @ecl/twig-composition-file-upload-status ``` -------------------------------- ### Default Skip Link Example Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/website/src/pages/ec/components/navigation/skip-link/docs/code.mdx Renders the default skip link component using the Playground and Html components. Ensure '@ecl/website-components' is installed and imported. ```javascript import { Playground, Html } from '@ecl/website-components'; import skipLink from '../demo'; ``` -------------------------------- ### Install Preset with Yarn Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/README.md Install a specific ECL preset using yarn. Ensure you have Node.js v20.9.0 or compatible. ```bash yarn add @ecl/preset-ec ``` -------------------------------- ### Install Description List Component Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/implementations/twig/components/description-list/README.md Install the description list component using npm. This command adds the package to your project's dependencies. ```shell npm install --save @ecl/twig-component-description-list ``` -------------------------------- ### Install Site Header Component Source: https://context7.com/ec-europa/europa-component-library/llms.txt Install the Site Header component using npm. This component provides the full EC/EU site header. ```bash npm install --save @ecl/twig-component-site-header ``` -------------------------------- ### Blockquote Playground Example Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/website/src/pages/ec/components/blockquote/docs/code.mdx This snippet shows how to use the Playground component to render the Blockquote component with its demo markup. Ensure '@ecl/website-components' is installed. ```javascript import { Playground, Html } from '@ecl/website-components'; import blockquote from '../demo'; ``` -------------------------------- ### Select Component Initialization and Methods Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/website/src/pages/ec/components/forms/select/docs/api.mdx This section details how to initialize the Select component, both automatically and manually, and how to retrieve an instance. It also covers the `autoInit` method with custom labels and how to get a component instance using `ECL.components.get()`. ```APIDOC ## Select Component API ### Initialization There are two primary ways to initialize the Select and Select Multiple components: #### Automatic Initialization Add the `data-ecl-auto-init="Select"` attribute to the component's markup. Then, call `ECL.autoInit()` when your page is ready or on a custom event. #### Manual Initialization 1. Get the target element using DOM selectors. 2. Create a new instance of `ECL.Select` by passing the element to the constructor. 3. Invoke the `init()` method on the instance. ```js var elt = document.querySelector('[data-ecl-select-multiple]'); var select = new ECL.Select(elt); select.init(); ``` ### `autoInit` Method It's also possible to use the `Select`'s `autoInit` method and pass specific labels for the element: ```js var select = ECL.Select.autoInit( document.querySelector('[data-ecl-select-multiple]'), { defaultText: 'string', searchText: 'string', selectAllText: 'string' }, ); ``` ### Retrieving Component Instance Once created, the new instance can be retrieved using `ECL.components.get()`: ```js ECL.components.get(document.querySelector('[data-ecl-select-multiple]')); ``` ``` -------------------------------- ### Manual Initialization with autoInit and Custom Labels Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/website/src/pages/ec/components/forms/select/docs/api.mdx Shows how to use the Select's autoInit method for manual initialization, allowing for custom default text, search text, and select all text. ```javascript var select = ECL.Select.autoInit( document.querySelector('[data-ecl-select-multiple]'), { defaultText: 'string', searchText: 'string', selectAllText: 'string' }, ); ``` -------------------------------- ### Tag Set Example Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/website/src/pages/eu/components/tag/docs/code.mdx Demonstrates a group of tags, often used for categorization or displaying multiple related attributes. This setup is useful for managing collections of tags. ```javascript import { Playground, Html } from '@ecl/website-components'; import { tagSet } from '../demo'; ``` -------------------------------- ### Basic File Upload Example Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/website/src/pages/ec/components/forms/file-upload/docs/code.mdx Demonstrates the default configuration for a single file upload. ```html
``` -------------------------------- ### Media Container Initialization Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/website/src/pages/ec/components/media/media-container/docs/api.mdx Demonstrates the two methods for initializing the Media Container component: automatic and manual. ```APIDOC ## Setup There are 2 ways to initialise the component. ### Automatic Add `data-ecl-auto-init="MediaContainer"` attribute to component's markup: ```html
...
``` Use the `ECL` library's `autoInit()` (`ECL.autoInit()`) when your page is ready or other custom event you want to hook onto. ### Manual Get target element, create an instance and invoke `init()`. Given you have 1 element with an attribute `data-ecl-media-container` on the page: ```js var elt = document.querySelector('[data-ecl-media-container]'); var mediaContainer = new ECL.MediaContainer(elt); mediaContainer.init(); ``` ``` -------------------------------- ### Select Component Initialization and Methods Source: https://github.com/ec-europa/europa-component-library/blob/v4-dev/src/website/src/pages/eu/components/forms/select/docs/api.mdx This section covers the different ways to initialize the Select component and provides examples of its methods. ```APIDOC ## Select Component API ### Initialization There are two primary methods for initializing the Select and Select Multiple components: #### Automatic Initialization Add the `data-ecl-auto-init="Select"` attribute to the component's HTML markup. Then, call `ECL.autoInit()` when the page is ready or on a custom event. ```javascript ECL.autoInit(); ``` #### Manual Initialization 1. Get the target element. 2. Create a new instance of `ECL.Select`. 3. Invoke the `init()` method. ```javascript var elt = document.querySelector('[data-ecl-select-multiple]'); var select = new ECL.Select(elt); select.init(); ``` ### `autoInit` Method with Options It's also possible to use the `Select`'s `autoInit` method and provide specific labels for the element: ```javascript var select = ECL.Select.autoInit( document.querySelector('[data-ecl-select-multiple]'), { defaultText: 'string', searchText: 'string', selectAllText: 'string' }, ); ``` ### Retrieving an Instance Once an instance is created, it can be retrieved using the `ECL.components.get()` method: ```javascript ECL.components.get(document.querySelector('[data-ecl-select-multiple]')); ``` ### API Reference Refer to the external API documentation for detailed information on available methods and properties.