0.0.0-snapshot-release-20250408123207 • Published 8 months ago

@justeattakeaway/pie-toast-provider v0.0.0-snapshot-release-20250408123207

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

@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

PropOptionsDescriptionDefault
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

NameDescriptionDefault
--toast-provider-z-indexControls the stacking order of the toast provider.--dt-z-index-toast (6000)

Events

EventDescription
pie-toast-provider-queue-updateTriggered when a toast is added or removed from the queue.

Usage Examples

The usage guideline is:

  • Place pie-toast-provider at the root level of your application or page.
  • Use the toaster utility 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.

0.5.5

5 months ago

0.5.4

6 months ago

0.5.3

6 months ago

0.5.2

6 months ago

0.5.1

6 months ago

0.5.0

6 months ago

0.4.2

6 months ago

0.4.1

6 months ago

0.4.0

7 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.8

9 months ago

0.2.7

9 months ago

0.2.6

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.3

9 months ago

0.2.2

9 months ago

0.2.1

10 months ago

0.2.0

11 months ago

0.1.0

11 months ago

0.0.0

12 months ago