Skip to main content
fixed example code
Source Link
mvdgun
  • 1.9k
  • 13
  • 22

You can use the addClass() method of the attribute class:

{%
  set classes = [
    'my-class-1',
    'my-class-2',
  ]
%}

<input{{ attributes.addClass(classes) }}>

You can either pass an array like the example above or pass a single class in the method directly: attributes.addClass('my-class').

For reference see the Drupal docs: https://www.drupal.org/docs/8/theming-drupal-8/using-attributes-in-templates

You can use the addClass() method of the attribute class:

  set classes = [
    'my-class-1',
    'my-class-2',
  ]

<input{{ attributes.addClass(classes) }}>

You can either pass an array like the example above or pass a single class in the method directly: attributes.addClass('my-class').

For reference see the Drupal docs: https://www.drupal.org/docs/8/theming-drupal-8/using-attributes-in-templates

You can use the addClass() method of the attribute class:

{%
  set classes = [
    'my-class-1',
    'my-class-2',
  ]
%}

<input{{ attributes.addClass(classes) }}>

You can either pass an array like the example above or pass a single class in the method directly: attributes.addClass('my-class').

For reference see the Drupal docs: https://www.drupal.org/docs/8/theming-drupal-8/using-attributes-in-templates

Source Link
mvdgun
  • 1.9k
  • 13
  • 22

You can use the addClass() method of the attribute class:

  set classes = [
    'my-class-1',
    'my-class-2',
  ]

<input{{ attributes.addClass(classes) }}>

You can either pass an array like the example above or pass a single class in the method directly: attributes.addClass('my-class').

For reference see the Drupal docs: https://www.drupal.org/docs/8/theming-drupal-8/using-attributes-in-templates