Display common GUI dialogs on macOS using cocoaDialog
Issues regarding the GUI should be opened on the cocoaDialog issue tracker.
npm install cocoa-dialog
import cocoaDialog from 'cocoa-dialog';
const result = await cocoaDialog('msgbox', {
title: 'Unicorn',
icon: 'favorite',
text: 'What do you want?',
button1: 'Gimme rainbow',
button2: 'Magicalifify'
});
if (result === '1') {
console.log('button1 clicked');
} else if (result === '2') {
console.log('button2 clicked');
}
Returns a Promise for result and resolves when the dialog is dismissed.
Type: string
Values:
bubblemsgboxok-msgboxyesno-msgboxinputboxstandard-inputboxsecure-inputboxsecure-standard-inputboxfileselectfilesavetextboxprogressbardropdownstandard-dropdownSee the cocoaDialog docs.
Type: object
Any of the options defined in the cocoaDialog docs can be used in a camel-cased form.
For example, ‑‑informative‑text should be informativeText: true.