@ecl/twig-component-tag

4.1.2 • Public • Published

ECL Tag component

npm package: @ecl/twig-component-tag

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

Parameters

  • "tag" (associative array) (default: 'predefined structure below')
    • type: string (default: 'link') can be 'link' or 'removable'
    • path: string (default: '') tag url if needed),
    • label: string (default: '') tag text as string,
    • external: boolean (default: false) External icon for a tag with link
    • aria_label: (string) (default: '') (optional) aria label for removable tag as a string
    • nowrap: boolean (default: false) force the tag to stay on one line
  • "icon_path" (string ) (default: '') - path for the icon image (need to render Icon component if tag type is 'removable')
  • "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'

Example:

{% include '@ecl/tag/tag.html.twig' with { 
  tag: { 
    type: 'removable', 
    path: '/example', 
    label: 'Tag 1' 
  }, 
  icon_path: '/path-to-the-icon-file', 
  extra_classes: 'my-extra-class-1 my-extra-class-2', 
  extra_attributes: [ 
    { name: 'data-test', value: 'data-test-value' }, 
    { name: 'data-test-1', value: 'data-test-value-1' } 
  ] 
} %}

Package Sidebar

Install

npm i @ecl/twig-component-tag

Weekly Downloads

239

Version

4.1.2

License

EUPL-1.2

Unpacked Size

21.2 kB

Total Files

6

Last publish

Collaborators

  • papegaill
  • yhuard
  • kalin.chernev
  • weslito
  • emeryro
  • planctus