@capacitor/action-sheet
The Action Sheet API provides access to native Action Sheets, which come up from the bottom of the screen and display actions a user can take.
Install
npm install @capacitor/action-sheet
npx cap sync
Variables
This plugin will use the following project variables (defined in your app's variables.gradle
file):
$androidxMaterialVersion
: version ofcom.google.android.material:material
(default:1.3.0
)
PWA Notes
PWA Elements are required for Action Sheet plugin to work.
Example
import { ActionSheet, ActionSheetButtonStyle } from '@capacitor/action-sheet';
const showActions = async () => {
const result = await ActionSheet.showActions({
title: 'Photo Options',
message: 'Select an option to perform',
options: [
{
title: 'Upload',
},
{
title: 'Share',
},
{
title: 'Remove',
style: ActionSheetButtonStyle.Destructive,
},
],
});
console.log('Action Sheet result:', result);
};
API
showActions(...)
showActions(options: ShowActionsOptions) => Promise<ShowActionsResult>
Show an Action Sheet style modal with various options for the user to select.
Param | Type |
---|---|
options |
|
Returns:
Promise<ShowActionsResult>
Since: 1.0.0