• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A message component for reactjs

React-Crouton Build Status

A message component for reactjs

Live Demo

Getting Started

Install via npm

   npm i react-crouton --save-dev

Usage

var Crouton = require('react-crouton')

var data = {
    id: Date.now(),
    type: 'error',
    message: 'Hello React-Crouton',
    autoMiss: true || false,
    onDismiss: listener,
    buttons: [{
        name: 'close',
        listener: function() {

        }
    }],
    hidden: false,
    timeout: 2000
}

<Crouton
    id={data.id}
    type={data.type}
    message={data.message}
    onDismiss={data.onDismiss}
    buttons={data.buttons}
    hidden={data.hidden}
    timeout={data.timeout}
    autoMiss={data.autoMiss}>
// You can render child component here
// <ChildComponent />
</Crouton>

Options

id required, every message need an unique id.

type: number

message required, the message what you want show.

type: string || array

example:

message: 'Hello React-Crouton'
message: ['Hello', 'React', '-', 'Crouton']

type required, define what type message you want to define.

type: string

hidden optional, control this property to show or hidden crouton.

type: boolean, default is false

buttons optional, define the buttons that you want show to the user.

type: string || array

example:

buttons: 'close'
butons: [{
    name: 'close'
}]
butons: [{
    name: 'close',
    listener: function() {
        console.log('close button clicked.')
    }
}]
butons: [{
    name: 'close',
    className: 'custom class name',
    listener: function() {
        console.log('close button clicked.')
    }
}]

autoMiss optional, crouton will auto missed if set this propterty, default is true.

type: boolean

timeout optional, set how long (ms) to auto dismiss the crouton.

type: number, default is 2000 ms (2 seconds)

onDismiss optional, crouton will invoke this listener when it dismissed.

type: function

License

MIT

More Repositories

1

go-sqlcipher

Golang SQLCipher driver conforming to the built-in database/sql interface and using the latest sqlite3 code.
C
205
star
2

react-native-player

Media player for React Native
Java
85
star
3

gulp-atom

A gulp plugin for atom electron or atom-shell distribute applications
JavaScript
35
star
4

douban-book

http://www.douban.com 豆瓣读书ios 客户端
Objective-C
31
star
5

react-range-slider

A flexible slider for reactjs.
JavaScript
29
star
6

aesf

RFC2898 key derivation AES encryption with sha1HMAC verification data encrypt/decrypt tool in golang
Go
7
star
7

react-event-mixin

Event binding cross browser for reactjs
JavaScript
5
star
8

grs

A github releases download stream module
JavaScript
4
star
9

go-async

Async http task write in golang, but used to in golang mobile develope
Go
4
star
10

cnbeta-rss

This is a demo for how to use golang build a common SDK library for both iOS and Android platform
Java
4
star
11

resume

Resume
HTML
3
star
12

persist.js

Offline storage for browser
JavaScript
3
star
13

nw-demo-sqlite3

nw with golang sqlcipher
JavaScript
3
star
14

contact

一个简单的毕业班同学在线通讯录
JavaScript
3
star
15

WeiboAPI

通过 HTTP 登录的方式实现微博部分没开放的 API
JavaScript
3
star
16

wzip

winzip implement in golang, with password protect zip compress and unzip decompress
2
star
17

iskindof

iskindof type in JavaScript
JavaScript
2
star
18

securitydemo

an Android security App Demo
2
star
19

grw

A stream wrapper github-releases module
JavaScript
2
star
20

event.log

Event.log allow u to log info by node event.
JavaScript
1
star
21

react-scrollbar-mixin

Detect scrollbar show or hideevent mixin for reactjs
JavaScript
1
star
22

strapi-starter-react-blog

JavaScript
1
star
23

ghost-storage-cloudflare-r2

Ghost storage for Cloudflare R2
TypeScript
1
star
24

aesf.js

RFC2898 key derivation AES encryption with sha1HMAC verification data encrypt/decrypt tool in JavaScript
1
star
25

forex-app

TypeScript
1
star
26

ISAD_work

信息系统分析与设计的课程设计
JavaScript
1
star
27

one-click-hugo-cms

CSS
1
star