Toast

Toasts are available as a web component using the skin-toast tag.

Attributes:

  • id: Unique ID (required if dismissible)
  • data-hide-duration: Duration (in minutes) to keep the toast hidden after dismissed (optional)
  • data-hide-transition: Duration (in milliseconds) of the dismissal transition, 250 by default (optional)
  • data-icon: Any valid skin-icon name (optional)
  • data-location: Location of the toast appearance in the window (optional)
  • data-location-id: Unique ID for the generated toast container (can be used to programmatically show toast, optional)
  • data-style: Alternate style (optional)

Valid locations include:

  • tl: Top left
  • tr: Top right
  • bl: Bottom left
  • br: Bottom right

Valid styles include:

  • bt: 4px top border
  • br: 4px right border
  • bb: 4px bottom border
  • bl: 4px left border

Examples

This is an unstyled toastThis is a custom toast with a bl style appliedThis is a default styled toast with bl style appliedThis is an informational toast with bt style appliedThis is a warning toastThis is an error toastThis is a success toastExample toast shown by button click

Programmatic toast

Toasts can be created programmatically using the Skin.Toast.create function.


        
        <skin-toast-container id="example-toast-container" data-style="br"></skin-toast-container>

<button
        type="button"
        id="toast-btn"
        class="tc-btn tc-style-default">Create toast
</button>

<script src="./path/to/skin.js"></script>

<script>

    let toastBtn = document.getElementById("toast-btn");

    toastBtn.addEventListener('click', () => {

        Skin.Toast.create({
            containerId: "example-toast-container",
            classes: "tc-style-success",
            innerHTML: "This is an example toast"
        });

    });

</script>