New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

lit-toast

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lit-toast

Web component for toasts implemented with LitElement.

latest
Source
npmnpm
Version
1.5.1
Version published
Maintainers
1
Created
Source

lit-toast

Published on webcomponents.org npm

Web component for toasts implemented with LitElement.

Demo

Installation

npm install lit-toast --save

Then, import lit-toast into your element:

import 'lit-toast/lit-toast.js';

or in an html file:

<script type="module" src="/path/to/lit-toast.js"></script>

Usage

In your LitElement class:

static get styles() {
  return css`
    :host {
      display: block;
    }
  `;
}
static get properties() {
  return {};
}

constructor() {
  super();
}

render() {
  return html`
    <button @click="${this._showToast}">
      Show Toast
    </button>
    <lit-toast></lit-toast>
  `;
}

/**
 * toast.show(message, [duration])
 * message: String
 * duration: Number in ms
 *
 * return: Promise<void>, resolved when the toast has finished
 */
_showToast() {
  this.shadowRoot.querySelector('lit-toast').show("I'm a toast", 2500);
}

Styling

lit-toast {
  --lt-border: 2px solid red;
}
CSS propertyDefault value
--lt-background-color#292929
--lt-bordernone
--lt-border-radius2px
--lt-bottom40px
--lt-color#dddddd
--lt-font-familysans-serif
--lt-font-size1em
--lt-padding16px
--lt-z-index2

Keywords

toast

FAQs

Package last updated on 07 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts