@justeattakeaway/pie-toast-provider v0.0.0-snapshot-release-20250206164440
@justeattakeaway/pie-toast-provider
Source Code | Design Documentation | NPM
@justeattakeaway/pie-toast-provider is a Web Component built using the Lit library. It offers a simple and accessible toast provider component for web applications.
Table of Contents
Installation
To install any of our web components in your application, we would suggest following the getting started guide to set up your project.
Ideally, you should install the component using the @justeattakeaway/pie-webc package, which includes all of the components. Or you can install the individual component package.
Documentation
Properties
| Prop | Options | Description | Default |
|---|---|---|---|
| options | {} | Default options for all toasts; accepts all toast props. | {} |
Slots
This component does not have any slots. All content is controlled through properties.
CSS Variables
| Name | Description | Default |
|---|---|---|
--toast-provider-z-index | Controls the stacking order of the toast provider. | --dt-z-index-toast (6000) |
Events
| Event | Description |
|---|---|
pie-toast-provider-queue-update | Triggered when a toast is added or removed from the queue. |
Usage Examples
The usage guideline is:
- Place
pie-toast-providerat the root level of your application or page. - Use the
toasterutility from any where in your app to dynamically create toasts.
For HTML:
// import as module into a js file e.g. main.js
import '@justeattakeaway/pie-webc/components/toast-provider.js'<!-- pass js file into <script> tag -->
<pie-toast-provider></pie-toast-provider>
<script type="module" src="/main.js"></script>For Native JS Applications, Vue, Angular, Svelte etc.:
// Vue templates (using Nuxt 3)
import '@justeattakeaway/pie-webc/components/toast-provider.js';
<pie-toast-provider></pie-toast-provider>For React Applications:
import { PieToastProvider } from '@justeattakeaway/pie-webc/react/toast-provider.js';
<PieToastProvider></PieToastProvider>Creating Toasts with toaster
The toaster utility dynamically creates toasts. It can be imported and called from any file or component in your application.
import { toaster } from '@justeattakeaway/pie-webc/components/toast-provider.js';
toaster.create({
message: 'This is a success toast!',
variant: 'success',
isDismissible: true,
});To clear all active and queued toasts:
toaster.clearToasts();Questions and Support
If you work at Just Eat Takeaway.com, please contact us on #help-designsystem. Otherwise, please raise an issue on Github.
Contributing
Check out our contributing guide for more information on local development and how to run specific component tests.
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago