Koji.ui.present.alert({
title: 'Image Posted',
message: 'Your new image is available on your fan wall!'
});
Presents dialog boxes and system alerts to users on the frontend of your Koji app.
Presents an alert dialog box to the user. Use this method for messages that require only an acknowledgement from the user. For messages that require a decision, use [[confirmation]]. For simple alerts that are dismissed automatically after a delay, without user interaction or a message, use [[systemAlert]].
options
- PresentAlertOptions, Defines an alert dialog box to show a user.
Koji.ui.present.alert({
title: 'Image Posted',
message: 'Your new image is available on your fan wall!'
});
Source: frontend/ui/present/index.ts#L87
Presents a confirmation dialog box to a user. Use this method for messages that require a decision from the user, such as to ask whether to proceed with an action. For messages that do not require a decision, use [[alert]] or [[systemAlert]].
options
- PresentConfirmationOptions, Defines a confirmation dialog box to show a user.
Promise<Boolean>, Whether the user confirmed (`true`) or cancelled (`false`) the action.
const confirmed = await Koji.ui.present.confirmation({
title: 'Delete File',
message: 'Are you sure you want to delete this file?',
confirmButtonLabel: 'Delete',
cancelButtonLabel: 'Cancel'
});
Source: frontend/ui/present/index.ts#L54
Presents a system alert (icon and label). System alerts are displayed for 1200ms and then dismissed automatically, allowing for an easy way to communicate state changes to a user. For dialog boxes that show messages and require user interaction, use [[alert]] or [[confirmation]].
type
- SystemAlertType, Type of system alert to display.
Koji.ui.present.systemAlert('success');
Defines an alert dialog box to show a user.
message
- String, Information to display to the user.
title
- String, Title for the dialog box.
Defines a confirmation dialog box to show a user.
cancelButtonLabel
- String (Optional), Label for the cancel action (`Cancel` by default).
confirmButtonLabel
- String (Optional), Label for the confirm action (`Confirm` by default).
message
- String (Optional), Question to ask the user (empty by default).
title
- String (Optional), Title for the dialog box (`Confirm` by default).
Type of a system alert – `success` (check mark), `sent` (message sent icon), `rejected` (alert icon), and `reported` (alert icon).