Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.18 KB

README.md

File metadata and controls

42 lines (32 loc) · 1.18 KB

A simple yet beautiful Snackbar popup component for React.

Install

Install using npm install snackbar-react

Usage

In a React app, use the Snackbar component:
import { Snackbar, showSnackbar } from 'snackbar-react'

<Snackbar
    open={true}
    type="success"
    message="Your username/password is not valid."
    autoHide={false}
/>

Or use as a function showSnackbar():

showSnackbar({
    open: true,
    type: "success",
    message: "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
    autoHide: false,
});

Snackbar props

Name Type Default Description
open Boolean true true or false
type string null 'info' or 'success' or 'error'
message string ''
handleClose function null
autoHide Boolean true true or false
autoHideDuration integer 5000 value in ms