All Projects → damikun → React-Toast

damikun / React-Toast

Licence: MIT license
Custom push notification (Toast) implementation under React + stayed by TailwindCSS.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to React-Toast

react-toast
Minimal toast notifications for React.
Stars: ✭ 47 (-36.49%)
Mutual labels:  toast, react-toast
react-native-toastboard
Toast feedback messages for React Native
Stars: ✭ 24 (-67.57%)
Mutual labels:  toast
Tfpopup
🚀🚀🚀TFPopup不生产弹框,它只是弹框的弹出工🚀🚀🚀默认支持多种动画方式一行调用,支持完全自定义动画.
Stars: ✭ 182 (+145.95%)
Mutual labels:  toast
Overlay support
a flutter toast and notification library
Stars: ✭ 232 (+213.51%)
Mutual labels:  toast
React Native Smart Tip
🔥🔥🔥Toast , SnackBar , Modal , Show Toast above Modal
Stars: ✭ 198 (+167.57%)
Mutual labels:  toast
Toasted Notes
simple, flexible toast notifications for react
Stars: ✭ 241 (+225.68%)
Mutual labels:  toast
Angular Notifier
A well designed, fully animated, highly customizable, and easy-to-use notification library for your Angular application.
Stars: ✭ 175 (+136.49%)
Mutual labels:  toast
toaststrap
A simple, lightweight JavaScript library for showing Bootstrap 5 toast popups.
Stars: ✭ 16 (-78.38%)
Mutual labels:  toast
Toast
🍞 The rounded and animated Android Toast for .NET WPF/XAML
Stars: ✭ 25 (-66.22%)
Mutual labels:  toast
Toast Swift
Toast view using swift.
Stars: ✭ 228 (+208.11%)
Mutual labels:  toast
Toast
A go package for Windows 10 toast notifications
Stars: ✭ 225 (+204.05%)
Mutual labels:  toast
Wc Messagebox
基于 Vue 2.0 开发的 Alert, Toast, Confirm 插件, UI仿照 iOS 原生
Stars: ✭ 203 (+174.32%)
Mutual labels:  toast
Teaset
A UI library for react native, provides 20+ pure JS(ES6) components, focusing on content display and action control.
Stars: ✭ 2,845 (+3744.59%)
Mutual labels:  toast
Sweetalert2
A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
Stars: ✭ 13,929 (+18722.97%)
Mutual labels:  toast
simple-notify
Pure javascript toast notifications.
Stars: ✭ 108 (+45.95%)
Mutual labels:  toast
React Notify Toast
Toast notifications for React.js
Stars: ✭ 176 (+137.84%)
Mutual labels:  toast
Snackbar
A tiny browser library for showing a brief message at the bottom of the screen (1kB gzipped).
Stars: ✭ 224 (+202.7%)
Mutual labels:  toast
Jh flutter demo
a flutter demo
Stars: ✭ 229 (+209.46%)
Mutual labels:  toast
toppy
Overlay library for Angular 7+
Stars: ✭ 81 (+9.46%)
Mutual labels:  toast
react-native-rooster
Your toast solution for react-native apps 🐔
Stars: ✭ 19 (-74.32%)
Mutual labels:  toast

React-Toast-Notify

React Toast Component

Online Demo

Description

This is custom toast component implemented by react hooks + React Context API and stayled using tailwindCSS framework. Feel free to inspirate by implementation :) This is trim of my UI lib that i use for my projects.

This componnent allow to push notifications to user screen and auto remove it after set or default time..

Example implements this push-Events:

  • Info
  • Error
  • Warning
  • Success
  • Custom body

Concepts

  • Responsive
  • Using Hooks and Context API
  • Using Tailwind and Fontawesome (All can be adjusted by endpoint user)

Installation

(!!! Package is not available on npm !!!)

  1. Clone the repo
    git clone https://github.com/damikun/React-Toast.git
  2. Restore packages
    yarn install
    
  3. Build and run demo
    yarn run start
    

Configuration API

Toast Provider

  • Usually placed in Providers.tsx or on top of App.tsx
  • Give you access to toast
  • In this example toast are send from "HomePage"
<ToastProvider variant={"top-right"}>
  <Layout>
    <HomePage />
  </Layout>
</ToastProvider>

Use hook to access toast actions

// Custom hook to access default context
const toast = useToast();
// OR
// Use of concrete conetxt
const toast = useContext(ToastContext);

Example:

export default function HomePage() {
  const toast = useToast();

  return (
    <div>
      <StayledButton
        variant="primaryred"
        onClick={() => toast?.pushError("Oppps Error", 5000)}
      >
        Error
      </StayledButton>
    </div>
  );
}

Various types to push

toast?.pushError("Error messgae", 5000);
toast?.pushWarning("Warning message"); // Default timeValue
toast?.pushSuccess("Success message");
toast?.pushInfo("Info Message");
toast?.push("Message", "Info", 2000);
toast?.pushCustom(<ToastCustomMessage />, 2000);
toast?.pushError("Error messgae", 5000, "truncate-2-lines");

Predefined types (can be extended)

type TostMessageType = "Info" | "Success" | "Warning" | "Error";

Support message truncate trim

type Truncate = "truncate-1-lines" | "truncate-2-lines" | "truncate-3-lines";

Pass any custom React.ReactNode component to body

toast?.pushCustom(<ToastCustomMessage />, 2000);
toast?.pushCustom(<div>My custom body</div>, 2000);

Various toast position

<ToastProvider variant={"top-right"}>
 // ...
</ToastProvider>

type Position "top_right" | "top_middle" | "top_left" | "bottom_right" | "bottom_middle" | "bottom_left"

Other

For valid display check that your React "root" is flexible and fulscreen to support all browsers behaviour...

// public/index.html
<div class="flex h-full w-full" id="root"></div>

Doc

You can read setp-by-step tutorial if you wanna start from scratch. (Currently writting / Not finished).

License

This project is licensed with the MIT license.

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].