Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

A lightweight, customizable, and accessible toast component that makes notifications in your React app delightful.

License

Notifications You must be signed in to change notification settings

mosespace/mtoast

Open more actions menu

Usage

To start using the library, install it in your project:

npm install @mosespace/toast@latest

add the following to your tailwind.config.ts

  content: [
    ...
    './node_modules/@mosespace/toast/**/*.{js,ts,jsx,tsx}', // Include this line
  ],

Add <Toaster /> to your app, it will be the place where all your toasts will be rendered. After that you can use toast() from anywhere in your app.

import { Toaster, toast } from '@mosespace/toast';

// ...

function App() {
  return (
    <div>
      <Toaster />
      <button onClick={() => toast.success('My first toast')}>
        Give me a toast
      </button>
      <button onClick={() => toast.custom(
        <div className="p-4 bg-purple-500 text-white rounded-lg">
          Custom Toast!
        </div>
      )}>
        Custom Toast
      </button>
    </div>
  );
}

Documentation

Find the full API reference in the documentation.

About

A lightweight, customizable, and accessible toast component that makes notifications in your React app delightful.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.