Giter VIP home page Giter VIP logo

bapple's Introduction

Installation

Install using NPM

npm install --save bapple

Basic Usage

Just import and call one of these: message, success, error, warning, info

import Bapple from 'bapple';

Bapple.message('Info toast', 'This is a toast to inform you of...', 5000);

// You can ignore description and timeout params.
Bapple.message('Successfully done!');

// And so on...
Bapple.success(...);
Bapple.error(...);
Bapple.warning(...);
Bapple.info(...);

More

There are some options that applies to all the toasts, and some options that affects only a single toast.

Global Options

Customize default options with Bapple.config, This will affect every toast.

  • direction: This determines the text direction, Left-to-Right or Right-to-Left. Available: ltr, rtl Default: ltr

  • position: By default, toasts appear in the left-bottom of your pages. But you are free to choose the right-bottom position. Available: left, right Default: left

  • size: Customize the size of your toast. Available: small, normal, large Default: normal

  • timeout: How long the toast will be visible, in milliseconds. This would be override for each toast, as mentioned above. Default: 5000

Example config for RTL support:

Bapple.config({
  direction: 'rtl',
  position: 'right',
  size: 'small',
  timeout: 10000
});

Options for each Toast

If you want more control over a single toast, you can use Bapple.add instead of Bapple.error or Bapple.success or...

  • type: This determines the style of your toast. Available: success, info, error, warning, message Default: message

  • title: Toast title

  • description: Toast description

  • timeout: How long the toast will be visible, in milliseconds. This will override the timeout from global options.

Example

Bapple.add({
  type: 'error',
  title: 'Your title here...',
  description: 'Description here...',
  timeout: 6000
});

bapple's People

Contributors

ilxanlar avatar

Stargazers

iraj.habibzadeh avatar Mehrnoosh Dashti avatar Hadi Farnoud avatar Ali Torki avatar Ahmad Tahani avatar Pedram Marandi  avatar Amir Habibzadeh avatar

Watchers

Hadi Farnoud avatar James Cloos avatar Amir Habibzadeh avatar  avatar Mohamad Mohebifar avatar Hamidreza Ahmadi avatar  avatar

bapple's Issues

Publish in Bower

Hi,

It's just a front-end package so please publish Bapple in Bower package manager for easier accessibility by front-end developers.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.