Action Sheet

Improve this doc

$ ionic plugin add cordova-plugin-actionsheet

Repo: https://github.com/EddyVerbruggen/cordova-plugin-actionsheet

The ActionSheet plugin shows a native list of options the user can choose from.

Requires Cordova plugin: cordova-plugin-actionsheet. For more info, please see the ActionSheet plugin docs.

Supported platforms

Usage

import { ActionSheet } from 'ionic-native';

let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
ActionSheet.show({
  'title': 'What do you want with this image?',
  'buttonLabels': buttonLabels,
  'addCancelButtonWithLabel': 'Cancel',
  'addDestructiveButtonWithLabel' : 'Delete'
}).then((buttonIndex: number) => {
  console.log('Button pressed: ' + buttonIndex);
});

Static Members

show(options)

Show a native ActionSheet component. See below for options.

Param Type Details
options ActionSheetOptions

Options See table below

Returns: Promise<any> Returns a Promise that resolves with the index of the button pressed (1 based, so 1, 2, 3, etc.)

hide()

Progamtically hide the native ActionSheet

Returns: Promise<any> Returns a Promise that resolves when the actionsheet is closed

ActionSheetOptions

Param Type Details
buttonLabels string[]

The labels for the buttons. Uses the index x

title
(optional)
string

The title for the actionsheet

androidTheme
(optional)
number

Theme to be used on Android

androidEnableCancelButton
(optional)
boolean

Enable a cancel on Android

winphoneEnableCancelButton
(optional)
boolean

Enable a cancel on Windows Phone

addCancelButtonWithLabel
(optional)
string

Add a cancel button with text

addDestructiveButtonWithLabel
(optional)
string

Add a destructive button with text

position
(optional)
number[]

On an iPad, set the X,Y position

API

Native

General