Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capacitor/dialog

Package Overview
Dependencies
Maintainers
8
Versions
645
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor/dialog

The Dialog API provides methods for triggering native dialog windows for alerts, confirmations, and input prompts

  • 0.4.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
31K
decreased by-4.32%
Maintainers
8
Weekly downloads
 
Created
Source

@capacitor/dialog

The Dialog API provides methods for triggering native dialog windows for alerts, confirmations, and input prompts

Install

npm install @capacitor/dialog
npx cap sync

Example

import { Dialog } from '@capacitor/dialog';

const showAlert = async () => {
  await Dialog.alert({
    title: 'Stop',
    message: 'this is an error',
  });
};

const showConfirm = async () => {
  const { value } = await Dialog.confirm({
    title: 'Confirm',
    message: `Are you sure you'd like to press the red button?`,
  });

  console.log('Confirmed:', value);
};

const showPrompt = async () => {
  const { value, cancelled } = await Dialog.prompt({
    title: 'Hello',
    message: `What's your name?`,
  });

  console.log('Name:', value);
  console.log('Cancelled:', cancelled);
};

API

  • alert(...)
  • prompt(...)
  • confirm(...)
  • Interfaces

alert(...)

alert(options: AlertOptions) => Promise<void>

Show an alert dialog

ParamType
optionsAlertOptions

Since: 1.0.0


prompt(...)

prompt(options: PromptOptions) => Promise<PromptResult>

Show a prompt dialog

ParamType
optionsPromptOptions

Returns: Promise<PromptResult>

Since: 1.0.0


confirm(...)

confirm(options: ConfirmOptions) => Promise<ConfirmResult>

Show a confirmation dialog

ParamType
optionsConfirmOptions

Returns: Promise<ConfirmResult>

Since: 1.0.0


Interfaces

AlertOptions
PropTypeDescriptionDefaultSince
titlestringTitle of the dialog.1.0.0
messagestringMessage to show on the dialog.1.0.0
buttonTitlestringText to use on the action button."OK"1.0.0
PromptResult
PropTypeDescriptionSince
valuestringText entered on the prompt.1.0.0
cancelledbooleanWhether if the prompt was canceled or accepted.1.0.0
PromptOptions
PropTypeDescriptionDefaultSince
titlestringTitle of the dialog.1.0.0
messagestringMessage to show on the dialog.1.0.0
okButtonTitlestringText to use on the positive action button."OK"1.0.0
cancelButtonTitlestringText to use on the negative action button."Cancel"1.0.0
inputPlaceholderstringPlaceholder text for hints.1.0.0
inputTextstringPrepopulated text.1.0.0
ConfirmResult
PropTypeDescriptionSince
valuebooleantrue if the positive button was clicked, false otherwise.1.0.0
ConfirmOptions
PropTypeDescriptionDefaultSince
titlestringTitle of the dialog.1.0.0
messagestringMessage to show on the dialog.1.0.0
okButtonTitlestringText to use on the positive action button."OK"1.0.0
cancelButtonTitlestringText to use on the negative action button."Cancel"1.0.0

Keywords

FAQs

Package last updated on 29 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc