Class “Stack”

Object > NativeObject > Widget > Composite > Stack

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

Type: Stack extends Composite
Constructor: public
Singleton: No
Namespace: tabris
Direct subclasses: None
JSX Support: Element: <Stack/>
Parent Elements: <Canvas/>, <Cell/>, <Composite/>, <Page/>, <RefreshComposite/>, <Row/>, <ScrollView/>, <Stack/>, <Tab/>
Child Elements: Any standalone widget element

Examples

JavaScript

import {Stack, contentView, TextView} from 'tabris';

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

stack.append(
  new TextView({text: 'one'}),
  new TextView({text: 'two'}),
  new TextView({text: 'three'})
);

See also:

JSX Creating a simple Stack
JSX Creating a Stack with horizontal alignment
JSX Creating a Stack with vertical alignment

Constructor

new Stack(properties?)

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

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: By Constructor or JSX
Change Event: Not supported

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

See also:

JSX stack-alignment.jsx

layout

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

Type: StackLayout
Default: StackLayout
Settable: By Constructor or JSX
Change Event: Not supported

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: 0
Settable: By Constructor or JSX
Change Event: Not supported

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