Skip to content

sud.showActionSheet ​

Displays an action sheet for the user to choose one item from a list.

javascript
sud.showActionSheet(object);

Parameters ​

PropertyTypeRequiredDescription
alertTextstringNoText displayed above the options
itemListArray<string>YesOption labels, up to 6 items
itemColorstringNoOption text color, such as #000000
successfunctionNoCalled when the user selects an item; see the fields below
failfunctionNoCalled when the request fails or the user cancels
completefunctionNoCalled after success or failure, with no arguments

Success Callback Parameters ​

PropertyTypeDescription
tapIndexnumberZero-based index of the selected item in itemList

Failure Callback Parameters ​

PropertyTypeDescription
errCodenumberError code
errMsgstringError or cancellation description

Usage Notes ​

Confirm that the target app supports this UI feature before using it. Provide a nonempty list of options. Canceling does not return a valid selection index; do not perform a selected action after cancellation.

Example ​

javascript
const items = ['View rules', 'Contact support'];

sud.showActionSheet({
  alertText: 'Choose an action',
  itemList: items,
  itemColor: '#000000',
  success(result) {
    console.log('Selected action', items[result.tapIndex]);
  },
  fail(error) {
    console.log('No selection made', error.errCode, error.errMsg);
  }
});