@ecl/twig-component-select
npm i @ecl/twig-component-select

@ecl/twig-component-select

ECL - Europa Component Library

by ec-europa

3.3.2 (see all)License:EUPL-1.2TypeScript:Not Found
npm i @ecl/twig-component-select
Readme

ECL Select component

npm package: @ecl/twig-component-select

npm install --save @ecl/twig-component-select

Parameters:

  • "id" (string) (default: '')
  • "options" (array) (default: []):
    • "value" (string) (default: '')
    • "label" (string) (default: '')
    • "selected" (boolean) (default: false)
    • "disabled" (boolean) (default: false)
  • "disabled" (boolean) (default: false)
  • "invalid" (boolean) (default: false)
  • "invalid_icon" (object of type "icon") (default: {})
  • "required" (boolean) (default: false)
  • "name" (string) (default: '')
  • "width" (string) (default: '') Input width size (s, m or l)
  • "icon_path" (string) (default: ''): file containing the svg icons
  • "multiple" (bolean) (default: false): For the multiple select
  • "multiple_placeholder" (string) (default: '') Placeholder for the multiple select
  • "multiple_all_text" (string) (default: '') Text for the select all option
  • "multiple_search_text" (string) (default: '') Text for the search box inside the multiple select
  • "multiple_search_no_results_text" (string) (default: '') Label label when there is no result by searching for an option
  • "extra_group_classes" (optional) (string) (default: '') Extra classes (space separated) for the select group
  • "extra_classes" (optional) (string) (default: '') Extra classes (space separated)
  • "extra_attributes" (optional) (array) (default: []) Extra attributes
    • "name" (string) Attribute name, eg. 'data-test'
    • "value" (string) Attribute value, eg: 'data-test-1'

Blocks:

  • "helper_text"
  • "invalid_text"
  • "required_text"
  • "optional_text"
  • "label"

Example:

{% include '@ecl/select/select.html.twig' with { 
  label: 'Select a country', 
  options: [ 
    { 
      value: 1, 
      label: 'Belgium' 
    }, 
    ... 
  ], 
  invalid: false, 
  invalid_text: 'Error message', 
  helper_text: 'Help message', 
  disabled: false, 
  id: 'example-id', 
  name: 'example-name', 
  width: 'm', 
  icon_path: '/static/icons.svg', 
  extra_classes: 'my-extra-class-1 my-extra-class-2', 
  extra_attributes: [ 
    { name: 'data-test-1', value: 'data-test-value-1' }, 
    { name: 'data-test-2', value: 'data-test-value-2' } 
  ] 
} %}

Downloads/wk

2

GitHub Stars

77

LAST COMMIT

3mos ago

MAINTAINERS

6

CONTRIBUTORS

22

OPEN ISSUES

0

OPEN PRs

7
VersionTagPublished
3.3.2
latest
18d ago
No alternatives found
No tutorials found
Add a tutorial