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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d7245ed · May 21, 2024

History

60 Commits
May 19, 2024
May 21, 2024
May 19, 2024
May 21, 2024
May 19, 2024
Apr 2, 2024
Apr 2, 2024
May 19, 2024
May 21, 2024
Mar 25, 2024
Mar 25, 2024
May 21, 2024
May 19, 2024
May 21, 2024
May 19, 2024

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