Skip to content
bahtuiv0.6.0

<baht-toast>

Toast host. Put ONE per page, call show() to display notifications.

Show a toast

Save

duration=0 in show() makes a sticky toast.

<baht-button id="toast-btn">Save</baht-button>
<baht-toast id="toaster"></baht-toast>

<script>
  const toaster = document.getElementById('toaster');
  document.getElementById('toast-btn').addEventListener('click', () => {
  toaster.show({ message: 'Saved.', tone: 'success' });
  });
</script>
NameTypeDefaultDescription
durationnumber4000Default auto-dismiss ms (0 = sticky)
EventdetailDescription
nameCustomEvent
baht-dismiss{ id, message }A toast went away