Class “Action”

Object > NativeObject > Widget > Action

An executable item that is integrated in the application’s navigation menu. Add a select listener to react to action taps.

Action on Android
Android
Action on iOS
iOS
Constructor public
Singleton No
Namespace tabris
Direct subclasses SearchAction
JSX support Element: <Action/>
Parent element: <NavigationView/>
Child elements: None
Text content: Sets title property

Example

import {Action, NavigationView, contentView} from 'tabris';

const navigationView = new NavigationView({layoutData: 'fill'})
  .appendTo(contentView);

new Action({
  title: 'Settings',
  image: 'resources/settings.png'
}).onSelect(() => console.log('Settings selected'))
  .appendTo(navigationView);

See also:

Constructor

new Action(properties?)

Parameter Type Optional Description
properties Properties<Action> Yes Sets all key-value pairs in the properties object as widget properties.

Properties

image

Icon image for the action.

On iOS the image is tinted with the apps default accent color whereas on Android the image is shown as is. When an action is placed into a NavigationView, the NavigationView property actionColor can be used to adjust the action tint color.

Type ImageValue
Settable Yes

placementPriority

Actions with higher placement priority will be placed at a more significant position in the UI, e.g. low priority actions could go into a menu instead of being included in a toolbar.

Type 'low' | 'high' | 'normal'
Default 'normal'
Settable Yes

title

The text to be displayed for the action.

When an action is placed into a NavigationView, the NavigationView property actionTextColor can be used to adjust the action title color on Android.

Type string
Settable Yes
JSX content type string

When using Action as an JSX element the element content is mapped to this property. Therefore

<Action>Hello World</Action>

has the same effect as:

<Action title='Hello World' />

Events

select

Fired when the action is invoked.

Change Events

imageChanged

Fired when the image property has changed.

Parameter Type Description
value ImageValue The new value of image.

placementPriorityChanged

Fired when the placementPriority property has changed.

Parameter Type Description
value string The new value of placementPriority.

titleChanged

Fired when the title property has changed.

Parameter Type Description
value string The new value of title.