1.4.1 • Published 4 years ago

dile-toast v1.4.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Moved

This package has moved and is now available at @dile/dile-toast. Please update your dependencies. This repository is no longer maintained.

dile-toast

This is a Web Component to send feedback to the user, inspired on the Material Design "toast" component, based on LitElement.

<dile-toast id="myToast" duration="5000"></dile-toast>

Let's go to DEMO page!

Properties

  • duration: number of microseconds the toast will be visible on the page.
  • messages: Array of message objects. You will not use usually this property directly to create feedback messages, instead of that is preferable to use the open () method to create the message object in the expected way for the component.

Methods

open(text, status)

To use this component and show feedback messages to the user, simpy call the open() method of the component. There are two arguments accepted:

  • text: The message you wish to send.
  • status: The status of the message: 'success', 'error' or 'neutral'. This is an optional argument, default value is 'neutral'.
let toastElement = document.getElementById('myToast');
toastElement.open('This is a success toast!!', 'success');

Style customization

The background color of the toast depends on the status of the message. You can customize it using the CSS custom properties bellow.

Custom propertyDescriptionDefault
--dile-toast-success-colorSuccess background color#27ae60
--dile-toast-error-colorError background color#e74c3c
--dile-toast-neutral-colorNeutral background color#303030
--dile-toast-text-colorText color#fff
--dile-toast-widthWith of the toast element280px
--dile-toast-paddingPadding for the toasts10px 15px
--dile-toast-z-indexz-index for the toasts1001
--dile-toast-font-weightMessages font weightnormal
--dile-toast-font-sizeMessages font size1em
--dile-toast-border-radiusBorder radius0
1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago