

Every state


default


loading


success


error


retrying


focus
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| id | string | "toast-promise" | unique on the page; the title and message ids hang off it. |
| promise | () => Promise<unknown> | simulatePublish | the work; the toast follows it from loading to success or error, and Try again calls it again. |
| loading | string | "Publishing article" | the title while it runs, e.g. "Publishing article". |
| loadingMessage | string | "Uploading 14 images and checking the links." | Loading message. |
| success | string | ((data: unknown) => string) | "Article published" | the title once it resolves; a function gets the resolved value. |
| successMessage | string | "It is live on your site and in the RSS feed." | Success message. |
| error | string | ((error: unknown) => string) | "Couldn’t publish" | the title once it rejects; a function gets the error. |
| errorMessage | string | "Two images are still uploading. Your draft is safe." | Error message. |
| viewHref | string | "#article" | View href. |
| viewLabel | string | "View article" | View label. |
| retryLabel | string | "Try again" | Retry label. |
| onSuccess | (data: unknown) => void | – | On success. |
| onError | (error: unknown) => void | – | On error. |
| open | boolean | – | controlled open state; leave it out to let the toast manage itself. |
| defaultOpen | boolean | true | Default open. |
| onOpenChange | (open: boolean) => void | – | On open change. |
| inline | boolean | false | draws the toast in place instead of in the fixed bottom-right viewport. |
| className | string | – | Class name. |
More toasts
All 7toast-03 is in UI ProGet UI Pro, €199


