Appearance
Function: failure()
ts
function failure(ctx: Context, options?: FailureOptions): Promise<{
button: string;
}>;Defined in: src/renderer/templates/failure.ts:59
Displays an error dialog.
Shows a bubble with icon, title, text, and buttons. Waits for user to click a button. Default: Close button with value 'ok'.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Render context |
options | FailureOptions | Dialog configuration |
Returns
Promise<{ button: string; }>
Clicked button value
Examples
ts
import {failure} from '@matterway/sdk/UI';
const {button} = await failure(ctx, {
icon: 'help',
title: 'Operation failed',
text: 'Could not process request. Please try again.'
});Usage with callout in text
ts
const {button} = await failure(ctx, {
title: 'Missing Data',
text: ':::error\nRequired product group not found.\n:::\nPlease add the missing data and try again.'
});