Components

Messages

Information

Try it yourself on the playground

Playground

Success

Try it yourself on the playground

Playground

Warning

Try it yourself on the playground

Playground

Error

Try it yourself on the playground

Playground

JS behaviour

Auto initialisation

In order to automatically initalise the JS behaviour, add data-ecl-auto-init="Message" to your component's markup:

<div
  role="alert"
  class="ecl-message ecl-message--info"
  data-ecl-message
  data-ecl-auto-init="Message"
>
  ...
</div>

Don't forget to call ECL.autoInit() when your page is ready!

Manual initialisation

When the document is ready, query the element. For example, you can use document.querySelector('[data-ecl-galmessagelery]') if you only have 1 message in the page.

Then, instantiate the Message component and call init():

var elt = document.querySelector('[data-ecl-message]');
var message = new ECL.Message(elt);
message.init();