react-toast-msg 2.5.6 → 2.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -21
- package/README.md +140 -140
- package/dist/style.css +1 -1
- package/package.json +64 -65
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 SudhuCodes
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SudhuCodes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
# React Toast MSG - (SudhuCodes)
|
|
2
|
-
|
|
3
|
-
A lightweight and customizable React toast notification library.
|
|
4
|
-
|
|
5
|
-

|
|
6
|
-

|
|
7
|
-

|
|
8
|
-
|
|
9
|
-

|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Features
|
|
14
|
-
|
|
15
|
-
- Lightweight & fast
|
|
16
|
-
- Tailwind CSS based styling
|
|
17
|
-
- Global & per-toast configuration
|
|
18
|
-
- Multiple toast variants
|
|
19
|
-
- Auto close with animation
|
|
20
|
-
- Manual close button support
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm i react-toast-msg
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Install Tailwind CSS
|
|
29
|
-
|
|
30
|
-
Make sure you have Tailwind CSS installed in your project.
|
|
31
|
-
|
|
32
|
-
### Import CSS
|
|
33
|
-
|
|
34
|
-
In your global CSS file (e.g., `index.css` or `App.css`), import the library's CSS:
|
|
35
|
-
|
|
36
|
-
```css
|
|
37
|
-
@import 'react-toast-msg/style.css';
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Usage
|
|
43
|
-
|
|
44
|
-
### 1. Add `ToastContainer` at the root of your application:
|
|
45
|
-
|
|
46
|
-
```jsx
|
|
47
|
-
import { toast, ToastContainer } from 'react-toast-msg';
|
|
48
|
-
|
|
49
|
-
export default function Example() {
|
|
50
|
-
return (
|
|
51
|
-
<>
|
|
52
|
-
<ToastContainer autoClose={3000} closeButton={true} />
|
|
53
|
-
<button onClick={() => toast('Default toast')}>Default</button>
|
|
54
|
-
<button onClick={() => toast.success('Success toast')}>Success</button>
|
|
55
|
-
{/* rest */}
|
|
56
|
-
<button onClick={() => toast.success('Success toast', { duration: 5000, closeButton: false })}>
|
|
57
|
-
Success with duration
|
|
58
|
-
</button>
|
|
59
|
-
</>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Custom Auto-Close Duration
|
|
67
|
-
|
|
68
|
-
You can now define a custom timeout per toast.
|
|
69
|
-
|
|
70
|
-
| Usage Example | Description |
|
|
71
|
-
| ----------------------------------------------- | ------------------------------------ |
|
|
72
|
-
| `toast('Message')` | Default timeout |
|
|
73
|
-
| `toast('Message', { duration: 1000 })` | Closes after 1000ms (1 second) |
|
|
74
|
-
| `toast.success('Saved')` | Success toast |
|
|
75
|
-
| `toast.success('Saved', { duration: 5000 })` | Success toast closes after 5 seconds |
|
|
76
|
-
| `toast.error('Error', { closeButton: true })` | Error toast with close button |
|
|
77
|
-
| `toast.warning('Warn', { closeButton: false })` | Warning without close button |
|
|
78
|
-
|
|
79
|
-
> Per-toast options always override ToastContainer defaults.
|
|
80
|
-
|
|
81
|
-
### Example:
|
|
82
|
-
|
|
83
|
-
```jsx
|
|
84
|
-
<button onClick={() => toast('This will close in 1 second', { duration: 1000 })}>
|
|
85
|
-
Show 1s Toast
|
|
86
|
-
</button>
|
|
87
|
-
|
|
88
|
-
<button onClick={() => toast.success('Success - 5s', { duration: 5000 })}>
|
|
89
|
-
Show 5s Success Toast
|
|
90
|
-
</button>
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## ToastContainer Props
|
|
96
|
-
|
|
97
|
-
| Prop | Type | Default | Description |
|
|
98
|
-
| ----------- | ------- | ------- | ------------------------------------------------- |
|
|
99
|
-
| autoClose | number | 3000 | Default close time in milliseconds for all toasts |
|
|
100
|
-
| closeButton | boolean | false | Close button visibility for all toasts |
|
|
101
|
-
|
|
102
|
-
Usage:
|
|
103
|
-
|
|
104
|
-
```jsx
|
|
105
|
-
<ToastContainer autoClose={3000} closeButton={false} /> // Default
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## Available Toast Variants
|
|
111
|
-
|
|
112
|
-
```js
|
|
113
|
-
toast('Default message');
|
|
114
|
-
toast.success('Success message');
|
|
115
|
-
toast.error('Error occurred');
|
|
116
|
-
toast.warning('Warning message');
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Contributing
|
|
122
|
-
|
|
123
|
-
Contributions are welcome. You can:
|
|
124
|
-
|
|
125
|
-
- Report issues
|
|
126
|
-
- Suggest features
|
|
127
|
-
- Submit pull requests
|
|
128
|
-
- Improve documentation or code quality
|
|
129
|
-
|
|
130
|
-
Repository: [https://github.com/sudhucodes/react-toast-msg](https://github.com/sudhucodes/react-toast-msg)
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## License
|
|
135
|
-
|
|
136
|
-
react-toast-msg is [MIT licensed](./LICENSE).
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
<p align="center"> <sub>© 2025 SudhuCodes — All rights reserved.</sub> </p>
|
|
1
|
+
# React Toast MSG - (SudhuCodes)
|
|
2
|
+
|
|
3
|
+
A lightweight and customizable React toast notification library.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Lightweight & fast
|
|
16
|
+
- Tailwind CSS based styling
|
|
17
|
+
- Global & per-toast configuration
|
|
18
|
+
- Multiple toast variants
|
|
19
|
+
- Auto close with animation
|
|
20
|
+
- Manual close button support
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm i react-toast-msg
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Install Tailwind CSS
|
|
29
|
+
|
|
30
|
+
Make sure you have Tailwind CSS installed in your project.
|
|
31
|
+
|
|
32
|
+
### Import CSS
|
|
33
|
+
|
|
34
|
+
In your global CSS file (e.g., `index.css` or `App.css`), import the library's CSS:
|
|
35
|
+
|
|
36
|
+
```css
|
|
37
|
+
@import 'react-toast-msg/style.css';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
### 1. Add `ToastContainer` at the root of your application:
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
import { toast, ToastContainer } from 'react-toast-msg';
|
|
48
|
+
|
|
49
|
+
export default function Example() {
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
<ToastContainer autoClose={3000} closeButton={true} />
|
|
53
|
+
<button onClick={() => toast('Default toast')}>Default</button>
|
|
54
|
+
<button onClick={() => toast.success('Success toast')}>Success</button>
|
|
55
|
+
{/* rest */}
|
|
56
|
+
<button onClick={() => toast.success('Success toast', { duration: 5000, closeButton: false })}>
|
|
57
|
+
Success with duration
|
|
58
|
+
</button>
|
|
59
|
+
</>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Custom Auto-Close Duration
|
|
67
|
+
|
|
68
|
+
You can now define a custom timeout per toast.
|
|
69
|
+
|
|
70
|
+
| Usage Example | Description |
|
|
71
|
+
| ----------------------------------------------- | ------------------------------------ |
|
|
72
|
+
| `toast('Message')` | Default timeout |
|
|
73
|
+
| `toast('Message', { duration: 1000 })` | Closes after 1000ms (1 second) |
|
|
74
|
+
| `toast.success('Saved')` | Success toast |
|
|
75
|
+
| `toast.success('Saved', { duration: 5000 })` | Success toast closes after 5 seconds |
|
|
76
|
+
| `toast.error('Error', { closeButton: true })` | Error toast with close button |
|
|
77
|
+
| `toast.warning('Warn', { closeButton: false })` | Warning without close button |
|
|
78
|
+
|
|
79
|
+
> Per-toast options always override ToastContainer defaults.
|
|
80
|
+
|
|
81
|
+
### Example:
|
|
82
|
+
|
|
83
|
+
```jsx
|
|
84
|
+
<button onClick={() => toast('This will close in 1 second', { duration: 1000 })}>
|
|
85
|
+
Show 1s Toast
|
|
86
|
+
</button>
|
|
87
|
+
|
|
88
|
+
<button onClick={() => toast.success('Success - 5s', { duration: 5000 })}>
|
|
89
|
+
Show 5s Success Toast
|
|
90
|
+
</button>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## ToastContainer Props
|
|
96
|
+
|
|
97
|
+
| Prop | Type | Default | Description |
|
|
98
|
+
| ----------- | ------- | ------- | ------------------------------------------------- |
|
|
99
|
+
| autoClose | number | 3000 | Default close time in milliseconds for all toasts |
|
|
100
|
+
| closeButton | boolean | false | Close button visibility for all toasts |
|
|
101
|
+
|
|
102
|
+
Usage:
|
|
103
|
+
|
|
104
|
+
```jsx
|
|
105
|
+
<ToastContainer autoClose={3000} closeButton={false} /> // Default
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Available Toast Variants
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
toast('Default message');
|
|
114
|
+
toast.success('Success message');
|
|
115
|
+
toast.error('Error occurred');
|
|
116
|
+
toast.warning('Warning message');
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Contributing
|
|
122
|
+
|
|
123
|
+
Contributions are welcome. You can:
|
|
124
|
+
|
|
125
|
+
- Report issues
|
|
126
|
+
- Suggest features
|
|
127
|
+
- Submit pull requests
|
|
128
|
+
- Improve documentation or code quality
|
|
129
|
+
|
|
130
|
+
Repository: [https://github.com/sudhucodes/react-toast-msg](https://github.com/sudhucodes/react-toast-msg)
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
react-toast-msg is [MIT licensed](./LICENSE).
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
<p align="center"> <sub>© 2025 SudhuCodes — All rights reserved.</sub> </p>
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@source '.';
|
|
1
|
+
@source '.';
|
package/package.json
CHANGED
|
@@ -1,66 +1,65 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-toast-msg",
|
|
3
|
-
"version": "2.5.
|
|
4
|
-
"description": "A lightweight, customizable React toast notification library with zero-config and fast setup.",
|
|
5
|
-
"files": [
|
|
6
|
-
"dist"
|
|
7
|
-
],
|
|
8
|
-
"scripts": {
|
|
9
|
-
"dev": "tsup --watch",
|
|
10
|
-
"prettier": "prettier --write src",
|
|
11
|
-
"build": "pnpm build:ts && pnpm build:css",
|
|
12
|
-
"build:ts": "tsup",
|
|
13
|
-
"build:css": "pnpx @tailwindcss/cli -i ./src/style.css -o ./dist/style.css"
|
|
14
|
-
},
|
|
15
|
-
"main": "dist/index.js",
|
|
16
|
-
"module": "dist/index.mjs",
|
|
17
|
-
"types": "dist/index.d.ts",
|
|
18
|
-
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"import": "./dist/index.mjs",
|
|
21
|
-
"require": "./dist/index.js"
|
|
22
|
-
},
|
|
23
|
-
"./style.css": "./dist/style.css"
|
|
24
|
-
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"react",
|
|
27
|
-
"toast",
|
|
28
|
-
"notification",
|
|
29
|
-
"react-toast",
|
|
30
|
-
"react-toastify",
|
|
31
|
-
"snackbar",
|
|
32
|
-
"react-toast-msg",
|
|
33
|
-
"rtm",
|
|
34
|
-
"toast-component"
|
|
35
|
-
],
|
|
36
|
-
"author": "SudhuCodes",
|
|
37
|
-
"license": "MIT",
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "git",
|
|
40
|
-
"url": "https://github.com/sudhucodes/react-toast-msg.git"
|
|
41
|
-
},
|
|
42
|
-
"bugs": {
|
|
43
|
-
"url": "https://github.com/sudhucodes/react-toast-msg/issues"
|
|
44
|
-
},
|
|
45
|
-
"homepage": "https://rtm.sudhucodes.com",
|
|
46
|
-
"peerDependencies": {
|
|
47
|
-
"react": "^18 || ^19",
|
|
48
|
-
"react-dom": "^18 || ^19"
|
|
49
|
-
},
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@tailwindcss/cli": "^4.1.18",
|
|
52
|
-
"@types/react": "^19.2.2",
|
|
53
|
-
"@types/react-dom": "^19.2.2",
|
|
54
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
55
|
-
"prettier": "^3.6.2",
|
|
56
|
-
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
57
|
-
"tailwindcss": "^4.1.18",
|
|
58
|
-
"tsup": "^8.5.0",
|
|
59
|
-
"typescript": "^5.9.3"
|
|
60
|
-
},
|
|
61
|
-
"dependencies": {
|
|
62
|
-
"clsx": "^2.1.1",
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-toast-msg",
|
|
3
|
+
"version": "2.5.7",
|
|
4
|
+
"description": "A lightweight, customizable React toast notification library with zero-config and fast setup.",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "tsup --watch",
|
|
10
|
+
"prettier": "prettier --write src",
|
|
11
|
+
"build": "pnpm build:ts && pnpm build:css",
|
|
12
|
+
"build:ts": "tsup",
|
|
13
|
+
"build:css": "pnpx @tailwindcss/cli -i ./src/style.css -o ./dist/style.css"
|
|
14
|
+
},
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"module": "dist/index.mjs",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.mjs",
|
|
21
|
+
"require": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./style.css": "./dist/style.css"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"react",
|
|
27
|
+
"toast",
|
|
28
|
+
"notification",
|
|
29
|
+
"react-toast",
|
|
30
|
+
"react-toastify",
|
|
31
|
+
"snackbar",
|
|
32
|
+
"react-toast-msg",
|
|
33
|
+
"rtm",
|
|
34
|
+
"toast-component"
|
|
35
|
+
],
|
|
36
|
+
"author": "SudhuCodes",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/sudhucodes/react-toast-msg.git"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/sudhucodes/react-toast-msg/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://rtm.sudhucodes.com",
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"react": "^18 || ^19",
|
|
48
|
+
"react-dom": "^18 || ^19"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@tailwindcss/cli": "^4.1.18",
|
|
52
|
+
"@types/react": "^19.2.2",
|
|
53
|
+
"@types/react-dom": "^19.2.2",
|
|
54
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
55
|
+
"prettier": "^3.6.2",
|
|
56
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
57
|
+
"tailwindcss": "^4.1.18",
|
|
58
|
+
"tsup": "^8.5.0",
|
|
59
|
+
"typescript": "^5.9.3"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"clsx": "^2.1.1",
|
|
63
|
+
"tailwind-merge": "^3.4.0"
|
|
64
|
+
}
|
|
66
65
|
}
|