Coder Social home page Coder Social logo

larsmaultsby / react-crouton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xeodou/react-crouton

0.0 2.0 0.0 454 KB

A message component for reactjs

Home Page: https://xeodou.github.io/react-crouton/

License: MIT License

JavaScript 80.18% HTML 6.80% CSS 13.02%

react-crouton's Introduction

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

react-crouton's People

Contributors

xeodou avatar winkler1 avatar

Watchers

James Cloos avatar Laurence Maultsby avatar

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.