3.0.0 • Published 4 years ago
cocoa-dialog v3.0.0
cocoa-dialog
Display common GUI dialogs on macOS using cocoaDialog
Issues regarding the GUI should be opened on the cocoaDialog issue tracker.
Install
npm install cocoa-dialogUsage
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');
}API
cocoaDialog(type, options)
Returns a Promise for result and resolves when the dialog is dismissed.
type
Type: string\
Values:
bubblemsgboxok-msgboxyesno-msgboxinputboxstandard-inputboxsecure-inputboxsecure-standard-inputboxfileselectfilesavetextboxprogressbardropdownstandard-dropdown
See the cocoaDialog docs.
options
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.
Related
- error-dialog - Display an error in a GUI dialog