New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@brancol/react-snackbar

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brancol/react-snackbar

Brancol - React Snackbar

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-76.92%
Maintainers
1
Weekly downloads
 
Created
Source

@brancol/react-snackbar

Snackbar Component developed for React JS.

This project was developed for custom styles, but is best integrated with Tailwind CSS. You can find more about the Tailwind CSS framework here.

Table of Contents

Installation

To install, you can use npm or yarn:

$ npm install @brancol/react-snackbar
$ yarn add @brancol/react-snackbar

Usage

To use the snackbar you must place a Context Provider on the top of the project.

index.js

import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'

import SnackbarProvider from '@brancol/react-snackbar'

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

App.js

import React from 'react'
import { useSnackbar } from '@brancol/react-snackbar'

export function App() {
  const snackbar = useSnackbar()
  return (
    <div>
      <h1>App</h1>
      <div>
        <button onClick={() => snackbar.showSuccess('Success Message')}>
          Show Success
        </button>
        <button onClick={() => snackbar.showWarning('Warning Message')}>
          Show Warning
        </button>
        <button onClick={() => snackbar.showDanger('Danger Message')}>
          Show Danger
        </button>
      </div>
    </div>
  )
}

Examples

Want more examples on how to use this snackbar or more use cases for your application?

Checkout my javascript React Tailwind - Base Project Or if you using typescript React Tailwind - Typescript Base Project

Props

Here is a full detailed list of the props you can send to use the SnackbarProvider.

NameTypeDefaultDescriptionValues
defaultPositionstringtrPosition of the Snackbar['tl', 'tc', 'tr', 'bl', 'bc', 'br']
defaultDisplayDurationnumber5000Time that the Snackbar will be displayed0 - 100000
defaultAnimationDelaynumber500Time that the Snackbar will take to fadein and fadeout100 - 3000
showIconbooleantrueIndicates if the left icon will be displayedtrue - false
showCloseIconbooleantrueIndicates if the close icon will be displayedtrue - false
render(props) => NodenullA custom Snackbar component with all propsReactNode

Options

When calling the useSnackbar open methos, you can send a list of options for that specific open.

NameTypeDescriptionValues
durationnumberTime that the Snackbar will be displayed100 - 1000
animationDelaynumberTime that the Snackbar will take to fadein and fadeout0 - 100000
positionstringPosition of the Snackbar['tl', 'tc', 'tr', 'bl', 'bc', 'br']
displayIconbooleanIndicates if the left icon will be displayedtrue - false
displayCloseIconbooleanIndicates if the close icon will be displayedtrue - false
stylestringThe style to be used as background and text['success', 'warning', 'danger', 'primary']

Projects

You can find other projects and more stuff in my:

Github Profile Personal Website Instagram Profile

Keywords

FAQs

Package last updated on 29 Jul 2020

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