Fork me on GitHub

Introduction

alt-notify was designed to be unopinionated for almost any use-case. This means that you can use this library for your flashing notifications like Facebook’s or Twitter’s), or for simple alert messages, or whatever you can think of.

You can dish out the whole thing yourself, but that’s tedious, right?

Here are some examples of the use-cases (Hey, nobody said that these apps use this library, aight?).

Facebook's Notification Drawer

Facebook’s Notification Drawer

Dropbox's Action Notification

Dropbox’s Action Notification

Important Notes

alt-notify is undergoing active development, and will be released soon (the same goes for the documentation).

This library was primarily written for use for React and Alt. It will and does not try to cover everyone’s use-cases – the reason why it is and will be kept as simple as possible.

ES6

Currently, alt-notify, like alt itself, is written in ES6 and transpiled with Babel.

SemVer

SemVer 2.0.0 Badge

Right now, this library is a work-in-progress, and will continue to have breaking changes (however follows SemVer) as long as necessary. Until v1.0, breaking changes will continue to bump v0.x. For example, v0.4.1 and v0.4.8 will have the same API, but 0.5.0 will have breaking changes.

Back to Top

Getting Started

Installation

npm version

For now, alt-notify is only available through npm:

npm install alt-notify --save

* Note that the --save option persists alt-notify to your package.json.

To check which versions of React and Alt the library supports, please check Supported Dependency Versions.

Usage

First, we’ll import the Drawer component that the library exposes.

import React from 'react';
import { Drawer } from 'alt-notify';

Then, we’ll use it in our top-most component (usually the App component as we call it).

class App extends React.Component {
  render() {
    return (
      <div>
        <Drawer render={(props) => {
          return <div>{props.data}</div>
        }} />
      </div>
    )
  }
}

To add items in our Drawer component, we’ll import NotifyActions.

import React;
import { Drawer, NotifyActions } from 'alt-notify';

And then use it like so:

class App extends React.Component {
  render() {
    return (
      <div>
        <Drawer render={(props) => {
          return <div>{props.data}</div>
        }} />

        <button type="button" onClick={this.addNotification}>
          Add a notification!
        </button>
      </div>
    )
  }

  addNotification() {
    NotifyActions.add({ data: 'I\'m a message. Hello.' });
  }
}

This is how our code should look like now:

import React;
import { Drawer, NotifyActions } from 'alt-notify';

class App extends React.Component {
  render() {
    return (
      <div>
        <Drawer render={(data) => {
          return <div>{data.text}</div>
        }} />

        <button type="button" onClick={this.addNotification}>
          Add a notification!
        </button>
      </div>
    )
  }

  addNotification() {
    NotifyActions.add({ data: 'I\'m a message. Hello.' });
  }
}

Hopefully, now you have an idea on how to use the library.

Examples

A plethora of examples has been setup to help you get started. It’s some sort of cookbook or something. You can go ahead check it on our repository.

At the time being, a lot of examples are still in development and will be available soon!

Back to Top

API Documentation

Back to Top

Miscellaneous

Changelog

v0.3.4 (commit)

v0.3.3(commit)

v0.3.2 (commit)

v0.3.1 (commit)

v0.3 (commit)

v0.2.1

v0.2

* Tag was removed due to npm accepts 0.2.0 but not 0.2 (which was the one written in the file).

v0.1.1

v0.1

Supported Dependency Versions

The version here will be bumped only if the support dependency version changes. For example, given the scenario that v0.1; v0.2; and v0.3 supports React v0.13 and Alt v0.15, while v0.4 supports a different version of React and Alt, only v0.1 and v0.4 will be noted.

Version React Alt
v0.1 v0.13 0.15

Back to Top