Skip to content

Commit 1a8b005

Browse files
chore: update readme
1 parent 9296daf commit 1a8b005

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

README.md

+59-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export default defineAppConfig({
182182

183183
By default, the module create an instance of `ninjaToaster` and inject it in the nuxt context in `useNuxtApp().$nt`.
184184

185-
You can create your own instance and inject it in the context by using a custom plugin.
185+
You can create your own instance and inject it in the context by using a custom plugin. Here we are using tailwindcss to style the toast.
186186

187187
1. Disable default plugin in `nuxt.config.ts` module options
188188
```ts
@@ -336,6 +336,64 @@ $toaster.error({
336336
})
337337
```
338338

339+
## Theming
340+
341+
### Minimal CSS theme
342+
343+
```css
344+
#nt-container {
345+
/* make container fit the screen */
346+
position: fixed;
347+
top: 0;
348+
left: 0;
349+
right: 0;
350+
bottom: 0;
351+
overflow: hidden;
352+
z-index: 100;
353+
pointer-events: none;
354+
355+
/* position the toasts using flexbox */
356+
display: flex;
357+
358+
/**
359+
* position all toasts in bottom of the screen
360+
* - use "flex-direction: column;" to position in top screen
361+
*/
362+
flex-direction: column-reverse;
363+
364+
/**
365+
* align all toasts to the center
366+
* - use "align-items: start" to aling to the left
367+
* - use "align-items: end" to aling to the right
368+
*/
369+
align-items: center;
370+
371+
/* add some space between toasts and screen */
372+
padding: 2rem;
373+
gap: 1rem;
374+
}
375+
376+
#nt-container [role='alert'] {
377+
/* allow toasts to be interactive */
378+
pointer-events: auto;
379+
380+
/* add styles to toasts */
381+
padding: 1rem;
382+
border-radius: 0.5rem;
383+
background-color: #fff;
384+
box-shadow: 0 0 1rem rgba(0, 0, 0, 0.1);
385+
}
386+
387+
388+
@media (max-width: 767px) {
389+
#nt-container {
390+
/* fit toasts to screen on mobile */
391+
padding: 0;
392+
}
393+
}
394+
395+
```
396+
339397

340398
## Development
341399

0 commit comments

Comments
 (0)