UNPKG

ionic-framework

Version:
74 lines (73 loc) 3.08 kB
import { OverlayController } from '../overlay/overlay-controller'; import { Config } from '../../config/config'; /** * @name ActionSheet * @description * The Action Sheet is a slide-up pane that lets the user choose from a set of options. Dangerous options are made obvious. * There are easy ways to cancel out of the action sheet, such as tapping the backdrop or even hitting escape on the keyboard for desktop testing. * * @usage * ```ts * openMenu() { * * this.actionSheet.open({ * buttons: [ * { text: 'Share This' }, * { text: 'Move' } * ], * destructiveText: 'Delete', * titleText: 'Modify your album', * cancelText: 'Cancel', * cancel: function() { * console.log('Canceled'); * }, * destructiveButtonClicked: () => { * console.log('Destructive clicked'); * }, * buttonClicked: function(index) { * console.log('Button clicked', index); * if(index == 1) { return false; } * return true; * } * * }).then(actionSheetRef => { * this.actionSheetRef = actionSheetRef; * }); * * } * ``` * * @demo /docs/v2/demos/action-sheet/ * @see {@link /docs/v2/components#action-sheets ActionSheet Component Docs} */ export declare class ActionSheet { constructor(ctrl: OverlayController, config: Config); /** * Create and open a new Action Sheet. This is the * public API, and most often you will only use ActionSheet.open() * * @param {Object} [opts={}] An object containing optional settings. * - `[Object]` `buttons` Which buttons to show. Each button is an object with a `text` field. * - `{string}` `titleText` The title to show on the action sheet. * - `{string=}` `cancelText` the text for a 'cancel' button on the action sheet. * - `{string=}` `destructiveText` The text for a 'danger' on the action sheet. * - `{function=}` `cancel` Called if the cancel button is pressed, the backdrop is tapped or * the hardware back button is pressed. * - `{function=}` `buttonClicked` Called when one of the non-destructive buttons is clicked, * with the index of the button that was clicked and the button object. Return true to close * the action sheet, or false to keep it opened. * - `{function=}` `destructiveButtonClicked` Called when the destructive button is clicked. * Return true to close the action sheet, or false to keep it opened. * @param {String} [opts.enterAnimation='action-sheet-slide-in'] The class used to animate an actionSheet that is entering. * @param {String} [opts.leaveAnimation='action-sheet-slide-out'] The class used to animate an actionSheet that is leaving. * @return {Promise} Promise that resolves when the action sheet is open. */ open(opts?: {}): any; /** * Retrieves an actionSheet instance. * * @param {String} [handle] The handle used to open the instance to be retrieved. * @returns {ActionSheet} An actionSheet instance. */ get(handle: any): any; }