Giter Club home page Giter Club logo

react-growl's Introduction

react-growl

A 'Growl' style notification ReactJS component.

INSTALL

npm install react-growl

Note on Requirements: Many in package.json are listed in order to run the demo. The only requirement to install this into your application is React.

EXAMPLE

Use npm to install. After installation, from the directory you installed into run:

bower install gulp serve

Will launch a browser with

USAGE

In your app's main file:

/** @jsx React.Dom */

var React = require("react");

var Growl = require("Growl/growl.react");

var MyApp = React.createClass({
	
	growler: null,

	componentDidMount: function() {

		// Setup your Growl Settings
		Growl.setPosition("tr"); // Bottom-Right(br) by default
		Growl.setMaxToShow(1); // Default is 8

		// set our internal variable to a reference to an instance of the growler
		this.growler = this.refs.growler;
	},

	// Give your whole app a method to call and trigger a notification.
	growl: function(level, msg) {
		this.growler.addNotification(level, msg);
	},

	// Somewhere in your main application view (so that it doesn't get unmounted) add an instance of Growl.
	render: function() {
		return (
			<div className="myApp">
				<Growl ref="growler" />
			</div>
		);
	}

});

module.exports = MyApp;

Static Methods

  • setPosition: @arg String inArray: ["tr", "tl", "tc", "br", "bl", "bc"]
    • Sets the position where all notifications will appear. Default: "br"
  • setMaxToShow: @arg Integer
    • The number of notifications to show before just showing "x more"
  • setDelay: @arg Integer ms
    • The amount of time, in milliseconds, a notification will appear. Be sure to include time needed for any initial animation when the notification is added.
  • getDelay: @returns Integer ms
  • noAnimation: void
    • If you are not using css animations for the notification show/remove, this will need called after you mount the component. If not called, the notifications will not be removed once the delay expires.

Copyright

Copyright (c) 2015 Moosylvania Marketing ([email protected])

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.