Dialog
Docs: https://docs.api.kunkun.sh/interfaces/index.IDialog
Dialog API is used to interact with the user by showing dialog boxes. This API is used to show alert, confirm, prompt, and file dialog boxes.
ask
: Shows a question dialog with Yes and No buttons.confirm
: Shows a question dialog with Ok and Cancel buttons.message
: Shows a message dialog with an Ok button.open
: Open a file/directory selection dialog.save
: Open a file/directory save dialog.
import { dialog } from "@kksh/api/ui/template";
import { dialog } from "@kksh/api/ui/custom";
import { dialog } from "@kksh/api/headless";
const answer = await dialog.ask('This action cannot be reverted. Are you sure?', { title: 'KK', kind: 'warning',});
const confirmation = await dialog.confirm( 'This action cannot be reverted. Are you sure?', { title: 'KK', kind: 'warning' });
await dialog.message('File not found', { title: 'KK', kind: 'error' });
const file = await open({ multiple: false, directory: false,});console.log(file);// Prints file path and name to the console
const path = await save({ filters: [ { name: 'My Filter', extensions: ['png', 'jpeg'], }, ],});// Prints the chosen path