electron-prompts
TypeScript icon, indicating that this package has built-in type declarations

0.9.13 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i electron-prompts

Weekly Downloads

15

Version

0.9.13

License

Apache-2.0

Unpacked Size

50.3 kB

Total Files

26

Last publish

Collaborators

  • xpbx