Your search did not match any results.

Action Sheet - Basics

The JavaScript ActionSheet component is a pop-up sheet that contains a set of buttons. These buttons allow users to perform custom actions related to a single task (call, send a message, delete, or edit a selected contact). This demo shows how to create a simple JavaScript ActionSheet and handle button clicks.

The source code for the Mvc version of this demo will be available soon.

Specify Buttons and Title

JavaScript ActionSheet can contain multiple buttons. To specify and configure them, use one of these properties:

  • items[]
    Accepts a local data array.

  • dataSource
    Accepts a local data array or a DataSource object. This object works with local and remote arrays and allows you to shape data.

For each button, you can specify a text, type, icon, template, and other properties. In this demo, the JavaScript ActionSheet buttons are configured in a local array assigned to the dataSource property. Each button includes the text property only.

If you want to display a title, assign the text to the title property.

Handle Button Clicks

You can assign a function to the onItemClick property to handle button clicks. Use the e.itemData field within the function to determine which button was clicked. You can also use the onCancelClick property handle a click on the built-in Cancel button. In this demo, the JavaScript ActionSheet component displays a notification with the button's name when you click a button.