Custom Events
Events communicate user intent to the host application. Examples include close or change. Events should be stateless only relaying user interaction and avoid changing the state of the element.
<nve-alert closable></nve-alert>
<script type="module">
const alert = document.querySelector('nve-alert');
alert.addEventListener('close', event => console.log(event));
</script>
Compatibility
Events should not include verb/action style prefixing such as on or trigger. Frameworks may add a prefix such as on to event handlers. React uses onClose={this.close}, for example.
Warning: use lowercase kebab events as some frameworks do not treat custom events as case sensitive. (read more)
Warning: avoid overloading existing default native custom events to avoid breaking user expectations on event behavior (read more)