🚀 8.9 Released! → ⚡️ New Node-API Engine Preview, 📲 ns widget ios, 💅 Tailwind v4 and more...
Read Announcement

NativeScript offers various dialogs, available via the Dialogs import from @nativescript/core, or globally.

ts
import { Dialogs } from '@nativescript/core'

Dialogs.alert(options)
Dialogs.action(options)
Dialogs.confirm(options)
Dialogs.prompt(options)
Dialogs.login(options)

// is the same as:
alert(options)
action(options)
confirm(options)
prompt(options)
login(options)

All dialogs take a DialogOptions object with the properties:

  • title: Sets the dialog title.
  • message : Sets the dialog message.
  • cancelable (Android only): Sets if the dialog can be canceled by taping outside of the dialog.
  • theme (Android only): Sets the theme of the Dialog. Usable themes can be found in R.style

See DialogOptions, R.style.

Avialable Dialogs

Alert

A dialog for alerting the user.

See alert().

Action

A dialog for prompting the user to choose.

Note: destructiveActionsIndexes allows setting some actions as destructive - shown in red. iOS only.

See action().

Confirm

A dialog for prompting the user to confirm.

See confirm().

Prompt

A dialog for prompting the user for input.

  • defaultText: Sets the default text to display in the input box.
  • inputType: Sets the prompt input type: email, decimal, phone, number, text, password, or email
  • capitalizationType: Sets the prompt capitalization type. Avalable options: none, allCharacters, sentences, or words.

See prompt(), CoreTypes.AutocapitalizationType

Login

A dialog for prompting the user for credentials.

See login().

Native Component

Next
Alert