Added example of using transient

Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>
This commit is contained in:
Andre Wanlin
2022-09-06 09:36:02 -05:00
parent 1ae86ab5fb
commit 66f74acaee
+15
View File
@@ -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,
});
};
```