Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-crouton

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-crouton

A message component for reactjs.

  • 0.2.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
increased by17.74%
Maintainers
1
Weekly downloads
 
Created
Source

React-Crouton

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}/>

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

Keywords

FAQs

Package last updated on 22 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc