Gracias por tu visita. Esta página solo está disponible en inglés.

APL Container

A Container is a layout that uses a subset of Flexbox/Yoga as the layout language.

Properties

The Container has the following properties in addition to the Component properties.

Property Type/Value Required Styled Description
alignItems stretch | center | start | end | baseline No No Alignment for children in the cross-axis. Defaults to stretch.
data Data No No Data to bind into this container.
direction column | row No No Direction that children will be laid out in. Defaults to column.
firstItem Array of components and layouts. No No Component to include before all others.
item(s) Array of components and layouts. No No Component(s) used to lay out the data set.
justifyContent start | end | center | spaceBetween | spaceAround No No How to distribute free space when there is room on the main axis. Defaults to start.
lastItem Component properties No No Component to include after all others.
numbered boolean No No If true, assign ordinal numbers to children. Defaults to false.

Unlike standard Flexbox containers, APL containers never scroll unless they are placed within a ScrollView.

alignItems

The Flexbox specification for how children should be aligned in the cross-axis of the container. Defaults to stretch.

data

An array of arbitrary data. If the data array is bound, the container uses the data array inflation method.

direction

The direction of layout in the container. Defaults to column.

firstItem

If assigned, a single component will be prepended to the container using the single child inflation method.

item(s)

An array of components to be displayed in the container.

lastItem

If assigned, a single component will be appended to the container using the single child inflation method.

justifyContent

The Flexbox specification for how free space will be distributed when there is room on the main axis. Only useful if the container is larger than the size of its children. Defaults to start.

numbered

If true, set the data-binding ordinal for each of the items in the sequence. The ordinals start with "1" and increment by one unless the numbering property in a child is set to "skip" or "reset". Note that the firstItem and lastItem do not participate in ordinal numbering. Defaults to false.

Container children

Children of containers have additional properties that control how that child is positioned in the parent container. The children of a container support the following additional properties. These properties are used by the Container to lay out the children.

Property Type Required Styled Description
alignSelf auto | start | end | center | baseline | stretch No No Cross-axis layout position. Defaults to auto.
bottom Dimension No No Specifies the distance from the bottom edge of the parent container. Used only for absolute positioning. Defaults to auto.
grow Number No No If positive, this component will stretch if there is extra space in the Container. Defaults to 0.
left Dimension No No Specifies the distance from the left edge of the parent container. Used only for absolute positioning. Defaults to 0.
numbering Dimension No No Control ordinal numbering of the next child. Defaults to normal.
position relative | absolute No No If absolute, this component will be positioned only with respect to the parent container. Defaults to 'relative'.
right Dimension No No Specifies the distance from the right edge of the parent container. Used only for absolute positioning. Defaults to auto.
shrink Number No No If positive, this component will shrink if there is not enough space in the Container. Defaults to 0.
spacing Dimension No No Additional space to add between this component and the previous component in the layout. Defaults to 0. The spacing property is not currently supported.
top Dimension No No Specifies the distance from the top edge of the parent container. Used only for absolute positioning. Defaults to 0.

alignSelf

Overrides the alignItems property for this child.

position, bottom, left, right, top

If position is set to "absolute", this child is taken out of the normal layout ordering for the container and instead positioned absolutely relative to the parent. The top, bottom, left, and right properties are dimensional offsets from the sides of the parent container.

grow, shrink

Flexbox grow and shrink properties. A positive grow value will stretch the component proportionally if there is extra space in the container. A positive shrink value will allow the component to shrink below its normal size if there is not enough space in the container.

numbering

Controls the ordinal value when the parent has set numbered. This property controls how the ordinal value will be updated for the next child in the sequence, not the current child in the sequence.

  • normal: The next child's ordinal = ordinal + 1.
  • skip: The next child's ordinal = ordinal
  • reset: The next child's ordinal = 1

spacing

An amount of spacing to add between this component and the previous component in the sequence. The first item in the sequence ignores spacing. The spacing must be specified in absolute dimensions. Relative dimensions are not supported.