Skip to content
NativeScript Unified

NativeScript views

DockLayout

<DockLayout> docks children to the top, right, bottom or left edge.

AttributeOnMeaning
dockchildtop, bottom, left or right. Anything else lands in the centre.
stretchLastChildDockLayoutDefault true: the last child fills the centre and its dock is ignored.

The polyfill uses a CSS grid with columns auto 1fr auto and rows auto 1fr auto. top and bottom children span all three columns, left and right sit in the middle row, and the centre is the middle cell. Several children on the same edge share that cell.

top
bottom
left
right
last child stretches into the centre

HTML-first equivalent

The polyfill is already a CSS grid with columns auto 1fr auto and rows auto 1fr auto. Write that grid directly, and let top and bottom children span all three columns:

top
left
centre
right
bottom