f365.ui, dialogs, toasts, prompts

Programmatic alert / confirm / prompt / toast / progress / custom dialog, never use window.alert/confirm/prompt.

The f365.ui namespace handles user-facing prompts. **Always use these instead of window.alert, window.confirm, or

window.prompt**, the f365 versions are styled to match the form's theme, work inside the SharePoint chrome, and are accessibility-instrumented.

Surface

PropertyDescription
showAlert(message, opts?)Modal alert. Returns when dismissed.
showConfirm(message, opts?)Modal confirm. Returns true on OK, false on Cancel.
showPrompt(message, opts?)Modal text-input prompt. Returns the entered string or null.
showToast(message, kind?)Non-blocking corner toast. kind: "info" | "success" | "warning" | "error".
showDialog<T>(spec)Custom dialog with arbitrary content. Returns the resolved value.
showProgress(message)Modal spinner. Returns a handle with close() and update(msg).
closeAllDialogs()Close every open dialog. Use sparingly, usually only at form unmount.

Examples

Confirm before destructive action

f365.events.onBeforeSave(async () => {
  if (f365.field('Status').value === 'Cancelled') {
    const ok = await f365.ui.showConfirm(
      'Cancelling this request notifies the customer. Are you sure?'
    );
    if (!ok) return { cancel: true };
  }
});

Background work with a progress dialog

const progress = f365.ui.showProgress('Validating against external system…');
try {
  const result = await f365.http.post('/api/validate', f365.data());
  progress.close();
  if (!result.ok) f365.ui.showToast(result.message, 'error');
} catch (err) {
  progress.close();
  f365.ui.showToast(String(err), 'error');
}