v1.1.11 — Now with React 19 support

Beautiful Snackbars
for React

A tiny, zero-dependency snackbar library for React 16–19. Fully customizable, TypeScript-ready, and weighs under 3 kB.

Everything you need, nothing you don't

Designed to drop in and get out of your way.

Lightweight

Under 3 kB gzipped. No runtime dependencies — just React and your imagination.

🎨
Customizable

Full control over position, duration, colors, close button, and content. Pass any JSX as the message.

⚛️
React 16 – 19

Tested against every major React version from 16 through the latest React 19 release.

🔷
TypeScript

Ships with first-class TypeScript types. Autocomplete and compile-time safety included.

Live Demo

Tweak position, color, and duration then fire a snackbar right in this page.

Position
Color preset
Duration — 4s
4s
Message

Installation

Add react-simple-snackbar to your project in seconds.

npm
npm install react-simple-snackbar
yarn
yarn add react-simple-snackbar
Provider setup — App.jsx
import SnackbarProvider from 'react-simple-snackbar'

function App() {
  return (
    <SnackbarProvider>
      <YourApp />
    </SnackbarProvider>
  )
}
Hook usage — Component.jsx
import { useSnackbar } from 'react-simple-snackbar'

function MyComponent() {
  const [openSnackbar, closeSnackbar] = useSnackbar()

  return (
    <button onClick={() => openSnackbar('Hello world!')}>
      Show snackbar
    </button>
  )
}

API

Everything you can pass to useSnackbar(options).

Prop Type Default Description
position string 'bottom-center' Where the snackbar appears. One of 7 positions.
style CSSProperties {} Inline styles applied to the snackbar box.
closeStyle CSSProperties {} Inline styles applied to the close button.
openSnackbar(node, duration?) function Opens the snackbar with the given ReactNode and optional duration in ms.
closeSnackbar() function Programmatically dismisses the current snackbar.
duration number 5000 Auto-close delay in milliseconds. Pass Infinity to disable.