Skip to content
NativeScript Unified

HTML first

Layout with flex and grid

Layout is CSS. Use flex for one dimension and grid for two.

Row and column

One
Two
Three
Stacked one
Stacked two

Distribute and grow

justify-* spreads children along the main axis, items-* aligns them across it, and grow lets a child take the remaining space.

A
B grows
C

Wrapping

1
2
3
4
5
6

Grid

Header
Side
Content

Positioning

A relative container with absolute children, positioned with left-* and top-*:

top left
bottom right

On native

On a device, Mason, MasonKit's layout engine, lays out the same elements with CSS flex, grid, block flow and positioning, so the classes above mean the same thing there. Lengths on MasonKit elements follow the web too: px is a CSS pixel, and rem, % and calc() resolve. See Writing shared HTML features for the rules shared templates follow.

If you have existing <StackLayout> or <GridLayout> markup, see NativeScript views.