diff --git a/apps/pie-docs/src/components/toast/overview/overview.md b/apps/pie-docs/src/components/toast/overview/overview.md index 0ec73914c1..00967df4de 100644 --- a/apps/pie-docs/src/components/toast/overview/overview.md +++ b/apps/pie-docs/src/components/toast/overview/overview.md @@ -224,6 +224,11 @@ Each level takes priority over those below it, queues alongside toasts of the sa tableData: priorityQueue } %} +{% notification { + type: "information", + message: "The priority queue is managed by the [Toast Provider](/components/toast/toast-provider/code/) in engineering." +} %} + --- ## Behaviours diff --git a/apps/pie-docs/src/components/toast/toast-provider/code.md b/apps/pie-docs/src/components/toast/toast-provider/code.md new file mode 100644 index 0000000000..33ca59e398 --- /dev/null +++ b/apps/pie-docs/src/components/toast/toast-provider/code.md @@ -0,0 +1,139 @@ +--- +eleventyNavigation: + key: Toast Provider + parent: Toast + order: 4 +shouldShowContents: true +eleventyComputed: + props: "{% include './props.json' %}" + events: "{% include './events.json' %}" +--- + +## Overview + +
+ +`pie-toast-provider` is a Web Component built using [Lit](https://lit.dev/). It offers a simple and accessible toast provider component for web applications. + +This component can be easily integrated into various frontend frameworks and customised through a set of properties. + +The `pie-toast-provider` component provides centralized management for toast notifications in an application. It ensures that toasts are displayed in [priority order](/components/toast/#priority-queue) based on their variant and actionable state, using a queueing system. The component handles the lifecycle of each toast, including dismissing the current toast and showing the next one. + +{% notification { + type: "information", + iconName: "engineers", + message: "You can try out this component on our [Storybook](https://webc.pie.design/?path=/docs/toast-provider) instance!" +} %} + +## Installation + +To install `pie-toast-provider` in your application, run the following on your command line: + +```shell +npm i @justeattakeaway/pie-webc +``` + +```shell +yarn add @justeattakeaway/pie-webc +``` + +{% notification { + type: "neutral", + iconName: "link", + message: "For more information on using PIE components as part of an application, check out the [Getting Started Guide](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components)." +} %} + +## Props + +{% componentDetailsTable { + tableData: props +} %} + +## Events + +{% componentDetailsTable { + tableData: events +} %} + +## 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. + +### Importing the component + +For HTML: + +```js +// import as module into a js file e.g. main.js +import '@justeattakeaway/pie-webc/components/toast-provider.js' +``` + +```html + +