From 66f74acaee7e55ac923aee95d5e139950150fc16 Mon Sep 17 00:00:00 2001 From: Andre Wanlin <67169551+awanlin@users.noreply.github.com> Date: Tue, 6 Sep 2022 09:36:02 -0500 Subject: [PATCH] Added example of using transient Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com> --- .changeset/strong-rice-warn.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.changeset/strong-rice-warn.md b/.changeset/strong-rice-warn.md index a18a41633d..c4fc28180b 100644 --- a/.changeset/strong-rice-warn.md +++ b/.changeset/strong-rice-warn.md @@ -18,3 +18,18 @@ Added option to allow the `AlertMessage` to be self-closing. This is done with a ``` The above example will set the transient timeout to 2500ms from the default of 5000ms + +Here's a rough example of how to trigger an alert using the new `transient` boolean: + +```ts +import { alertApiRef, useApi } from '@backstage/core-plugin-api'; + +const exampleTransient = () => { + const alertApi = useApi(alertApiRef); + alertApi.post({ + message: 'Example of Transient Alert', + severity: 'success', + transient: true, + }); +}; +```