Class “Stack”

Object > NativeObject > Widget > Composite > Stack

A composite with the layout property initialized with a Stack. All children are automatically arranged in one vertical stack, starting from the top. The layoutData on the children is ignored.

Constructor public
Singleton No
Namespace tabris
Direct subclasses None
JSX support Element: <Stack/>
Parent element: <Composite/> and any widget extending Composite
Child elements: Widgets
Text content: Not supported

Example

import {Stack, contentView} from 'tabris';

const stack = new Stack({
  layoutData: 'fill',
  spacing: 16
}).appendTo(contentView);

stack.append(
   new TextView({text: 'top'}),
   new TextView({text: 'center'}),
   new TextView({text: 'bottom'})
);

See also:

Constructor

new Stack(properties?)

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

Properties

alignment

Determines the horizontal placement of the children. For the stretchX value to work correctly the Stack needs to be given a width either by setting width or by setting left and right.

Type 'left' | 'centerX' | 'stretchX' | 'right'
Default 'left'
Settable On creation
Change events No

This property can only be set via constructor or JSX. Once set, it cannot change anymore.

layout

The stack layout manager responsible for interpreting the layoutData of the child widgets of this Composite.

Type StackLayout
Default StackLayout
Settable On creation
Change events No

This property can only be set via constructor or JSX. Once set, it cannot change anymore.

spacing

Additional space to add between the children in device independent pixel.

Type number
Default 16
Settable On creation
Change events No

This property can only be set via constructor or JSX. Once set, it cannot change anymore.