All Projects → bmcmahen → Toasted Notes

bmcmahen / Toasted Notes

simple, flexible toast notifications for react

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Toasted Notes

Burnttoast
Module for creating and displaying Toast Notifications on Microsoft Windows 10.
Stars: ✭ 796 (+230.29%)
Mutual labels:  notifications, toast
Notyf
👻 A minimalistic, responsive, vanilla JavaScript library to show toast notifications.
Stars: ✭ 2,093 (+768.46%)
Mutual labels:  notifications, toast
Reapop
📮 A simple and customizable React notifications system
Stars: ✭ 1,155 (+379.25%)
Mutual labels:  notifications, toast
Vue Snotify
Vuejs 2 Notification Center
Stars: ✭ 755 (+213.28%)
Mutual labels:  notifications, toast
Angular Notifier
A well designed, fully animated, highly customizable, and easy-to-use notification library for your Angular application.
Stars: ✭ 175 (-27.39%)
Mutual labels:  notifications, toast
Notie
🔔 a clean and simple notification, input, and selection suite for javascript, with no dependencies
Stars: ✭ 6,170 (+2460.17%)
Mutual labels:  notifications, toast
Svelte Notifications
Svelte toast notifications component that can be used in any JS application
Stars: ✭ 146 (-39.42%)
Mutual labels:  notifications, toast
Cogo Toast
Beautiful, Zero Configuration, Toast Messages for React. Only ~ 4kb gzip, with styles and icons
Stars: ✭ 557 (+131.12%)
Mutual labels:  notifications, toast
Notiflix
Notiflix is a JavaScript library for client-side non-blocking notifications, popup boxes, loading indicators, and more that makes your web projects much better.
Stars: ✭ 172 (-28.63%)
Mutual labels:  notifications, toast
React Toast Notifications
🍞 A toast notification system for react
Stars: ✭ 2,103 (+772.61%)
Mutual labels:  notifications, toast
Vue Toastification
Vue notifications made easy!
Stars: ✭ 747 (+209.96%)
Mutual labels:  notifications, toast
Sweetalert2
A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
Stars: ✭ 13,929 (+5679.67%)
Mutual labels:  notifications, toast
Gsmessages
A simple style messages/notifications, in Swift.
Stars: ✭ 595 (+146.89%)
Mutual labels:  notifications, toast
Laravel Notify
Flexible Flash notifications for Laravel
Stars: ✭ 787 (+226.56%)
Mutual labels:  notifications, toast
Toastify Js
Pure JavaScript library for better notification messages
Stars: ✭ 570 (+136.51%)
Mutual labels:  notifications, toast
Jquery Toast Plugin
Highly customizable jquery plugin to show toast messages
Stars: ✭ 1,237 (+413.28%)
Mutual labels:  notifications, toast
Ftindicator
A light wight UI package contains local notification, progress HUD, toast, with blur effect, elegant API and themes support.
Stars: ✭ 292 (+21.16%)
Mutual labels:  notifications, toast
Ng Snotify
Angular 2+ Notification Center
Stars: ✭ 304 (+26.14%)
Mutual labels:  notifications, toast
Notistack
Highly customizable notification snackbars (toasts) that can be stacked on top of each other
Stars: ✭ 2,562 (+963.07%)
Mutual labels:  notifications, toast
React Notify Toast
Toast notifications for React.js
Stars: ✭ 176 (-26.97%)
Mutual labels:  notifications, toast

Toasted-notes

npm package Tweet Follow on Twitter

A simple but flexible implementation of toast style notifications for React extracted from Sancho UI.

View the demo and documentation.

Features

  • An imperative API. This means that you don't need to set component state or render elements to trigger notifications. Instead, just call a function.
  • Render whatever you want. Utilize the render callback to create entirely custom notifications.
  • Functional default styles. Import the provided css for some nice styling defaults or write your own styles.

Install

Install toasted-notes and its peer dependency, react-spring, using yarn or npm.

yarn add toasted-notes react-spring

Example

import toaster from "toasted-notes";
import "toasted-notes/src/styles.css"; // optional styles

const HelloWorld = () => (
  <button
    onClick={() => {
      toaster.notify("Hello world", {
        duration: 2000
      });
    }}
  >
    Say hello
  </button>
);

API

The notify function accepts either a string, a react node, or a render callback.

// using a string
toaster.notify("With a simple string");

// using jsx
toaster.notify(<div>Hi there</div>);

// using a render callback
toaster.notify(({ onClose }) => (
  <div>
    <span>My custom toaster</span>
    <button onClick={onClose}>Close me please</button>
  </div>
));

It also accepts options.

toaster.notify("Hello world", {
  position: "bottom-left", // top-left, top, top-right, bottom-left, bottom, bottom-right
  duration: null // This notification will not automatically close
});

Using Context

One downside to the current API is that render callbacks and custom nodes won't get access to any application context, such as theming variables provided by styled-components. To ensure that render callbacks have access to the necessary context, you'll need to supply that context to the callback.

const CustomNotification = ({ title }) => {
  const theme = useTheme();
  return <div style={{ color: theme.primary }}>{title}</div>;
};

const CustomNotificationWithTheme = withTheme(CustomNotification);

toaster.notify(() => <CustomNotificationWithTheme title="I am pretty" />);

Contributors

License

MIT

Prior art

Way back, this was originally based on the wonderful implementation of notifications in evergreen.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].