Skip to content

divyanshu-rawat/react-alerts-npm

Repository files navigation

forthebadge

forthebadge

forthebadge

forthebadge

DEMO

Installation:

$ npm i react-alerts-component

This package is used in production by following application:

UseCase

First you have to wrap your app with the Provider giving it the alert template and optionally some options.

  import React, { Component } from 'react'
  import { render } from 'react-dom'
  import Alert from 'react-alerts-component'
  
  const options = {
    margin: '10',
    width : "500",
    fontColor : 'black',
    backgroundColor : 'grey'
  }


  class App extends Component  {
    render () {
      return (
        <Alert />
      )
    }
  }

  render(<App />, document.getElementById('root'))

Options

You can pass the following options as props to <Alert />:

  const options = {
    type: String,
    message: String,
    margin: String,
    width : String,
    fontColor : String,
    backgroundColor : String
  }
  

Values that type can take are as follows:

  • default
  • danger
  • warning
  • secondary
  • info
  • success
  • light
  • custom

alt tag