Skip to content

An easy tool to enable prompts from the Electron main process

License

Notifications You must be signed in to change notification settings

pbxx/electron-prompts

Repository files navigation

electron-prompts

NPM Version NPM Type Definitions Docs

An easy tool for creating interactive prompts from the Electron main process

Logo

Installation

npm install electron-prompts

Usage

Import and instantiate a PromptManager for your project:

import PromptManager from "electron-prompts"

const prompts = new PromptManager()

Create and spawn GUI prompts using simple Prompt Templates:

const pTemplate = {
	windowTitle: "electron-prompts",
	cancelButton: {
		classes: ["btn", "btn-secondary"]
	},
	elements: [
		{
			type: "header",
			value: "Enter test value",
		},
		{
			type: "paragraph",
			value: "This is an easy user-input prompt made with electron-prompts:",
		},
		{
			type: "input",
			name: "testValue",
			placeholder: "Test input",
			value: "I am the default value",
			classes: ["form-control"],
		},
	],
	buttons: [
		{
			name: "submit",
			value: "Save Changes",
			classes: ["btn", "btn-primary"],
		},
	],
}

const result = await prompts.spawn(pTemplate)

Further documentation available here.

About

An easy tool to enable prompts from the Electron main process

Resources

License

Stars

Watchers

Forks

Packages

No packages published