Skip to content

wayou/toos

Repository files navigation

toos

CircleCI MIT LICENSE npm package npm package

A simple toast.

Toos pronouses the same as Chinese word 「吐司」.

Preview

toos preview

Installing

Using command line:

$ yarn add toos
# or
$ npm i -S toos

Using CDN:

<script src="//unpkg.com/toos/dist/toos.umd.js"></script>

Usage

import toos from 'toos';

toos.show('Allo!');

toos.show('Allo!', {
    style: 'color:red;'
});

Methods

  • show: (message: string | number, options: ToastOptions) => void: show the toast
    • message: the message to show
      • type: string
      • default: N/A
    • options: use the option object to custumize the toast
      • style: style for the toast
        • type: string
        • default:
      • class: class name to customize the style
        • type: string
        • default:
      • duration?: number: toast duration in ms
        • type: number
        • default: 300

Examples

See the stories for examples