Skip to content
pixi-silk
GitHub repository
Interface

SmartLayout

import type { SmartLayout } from 'pixi-silk/ui/layout';

A responsive style: base values, then portrait or landscape, then each matching media rule in order. Rules test the root container’s layout area.

Extends#

Properties#

PropertyTypeDescriptionInherited fromDefined in
alignContent?AlignContentLine distribution of a wrapping container. Default stretch.SmartStyle.alignContentlayout/style.ts:82
alignItems?AlignItemsCross axis alignment of the children. Default stretch.SmartStyle.alignItemslayout/style.ts:76
alignSelf?"auto" | AlignItemsCross axis alignment of this node, over its parent’s alignItems.SmartStyle.alignSelflayout/style.ts:78
animate?booleanGlide this child to new slots. Default the container’s transition.SmartStyle.animateui/layout/flex-container.ts:33
aspectRatio?numberWidth divided by height. Sizes the missing axis when only one is known.SmartStyle.aspectRatiolayout/style.ts:102
basis?LengthMain size before growing or shrinking. Default auto (the width or height, else the content).SmartStyle.basislayout/style.ts:88
bottom?LengthDistance from the parent’s bottom edge, for position: 'absolute'.SmartStyle.bottomlayout/style.ts:108
columnGap?numberSpace between columns. Overrides gap.SmartStyle.columnGaplayout/style.ts:54
direction?FlexDirectionMain axis. Default row.SmartStyle.directionlayout/style.ts:46
display?"none" | "flex"none takes the node out of layout: it gets a zero box. Default flex.SmartStyle.displaylayout/style.ts:42
fit?FitModeHow the child scales into its slot. Default none.SmartStyle.fitui/layout/flex-container.ts:17
fitAlign?readonly [number, number]Where the child sits in its slot, 0 to 1 per axis. Default [0.5, 0.5], the centre.SmartStyle.fitAlignui/layout/flex-container.ts:19
gap?numberSpace between items and between lines, in pixels. Default 0.SmartStyle.gaplayout/style.ts:50
grow?numberShare of the free space this item takes. Default 0.SmartStyle.growlayout/style.ts:84
height?LengthBorder-box height. Default auto.SmartStyle.heightlayout/style.ts:92
inset?LengthSets top, right, bottom and left at once. The single sides override it.SmartStyle.insetlayout/style.ts:112
justifyContent?JustifyContentMain axis distribution of the free space. Default start.SmartStyle.justifyContentlayout/style.ts:80
landscape?SmartStyleValues for a landscape area.-ui/layout/flex-container.ts:58
left?LengthDistance from the parent’s left edge, for position: 'absolute'.SmartStyle.leftlayout/style.ts:110
margin?Edges<Length>Space outside the box. 'auto' takes up free space, which centres or pushes the item.SmartStyle.marginlayout/style.ts:66
marginBottom?LengthBottom margin. Overrides margin.SmartStyle.marginBottomlayout/style.ts:72
marginLeft?LengthLeft margin. Overrides margin.SmartStyle.marginLeftlayout/style.ts:74
marginRight?LengthRight margin. Overrides margin.SmartStyle.marginRightlayout/style.ts:70
marginTop?LengthTop margin. Overrides margin.SmartStyle.marginToplayout/style.ts:68
maxHeight?LengthLargest height. Default none.SmartStyle.maxHeightlayout/style.ts:100
maxScale?numberLargest fit scale. Default no limit.SmartStyle.maxScaleui/layout/flex-container.ts:23
maxWidth?LengthLargest width. Default none.SmartStyle.maxWidthlayout/style.ts:98
measure?(child: Container, availableWidth: number, availableHeight: number) => SizeMeasures the child for the space offered. Default its local bounds, whatever the space.SmartStyle.measureui/layout/flex-container.ts:25
media?readonly MediaRule[]Width, orientation and breakpoint rules.-ui/layout/flex-container.ts:60
minHeight?LengthSmallest height. Default 0.SmartStyle.minHeightlayout/style.ts:96
minScale?numberSmallest fit scale. With fit: 'scale-down' it is the text shrink-to-fit floor. Default 0.SmartStyle.minScaleui/layout/flex-container.ts:21
minWidth?LengthSmallest width. Default 0.SmartStyle.minWidthlayout/style.ts:94
onSize?(width: number, height: number, child: Container) => voidCalled with the slot size whenever it changes, so the child can redraw at that size (a panel background, a bar). A child with onSize and no measure measures as 0 by 0, so give it a size, grow or inset.SmartStyle.onSizeui/layout/flex-container.ts:31
padding?Edges<number | `${number}%`>Space inside the box. Percents are of the parent’s width, as in CSS.SmartStyle.paddinglayout/style.ts:56
paddingBottom?number | `${number}%`Bottom padding. Overrides padding.SmartStyle.paddingBottomlayout/style.ts:62
paddingLeft?number | `${number}%`Left padding. Overrides padding.SmartStyle.paddingLeftlayout/style.ts:64
paddingRight?number | `${number}%`Right padding. Overrides padding.SmartStyle.paddingRightlayout/style.ts:60
paddingTop?number | `${number}%`Top padding. Overrides padding.SmartStyle.paddingToplayout/style.ts:58
portrait?SmartStyleValues for a portrait area.-ui/layout/flex-container.ts:56
position?"relative" | "absolute"absolute places the node against its parent’s box with top, right, bottom and left.SmartStyle.positionlayout/style.ts:44
right?LengthDistance from the parent’s right edge, for position: 'absolute'.SmartStyle.rightlayout/style.ts:106
rowGap?numberSpace between lines (rows). Overrides gap.SmartStyle.rowGaplayout/style.ts:52
shrink?numberShare of the overflow this item gives up, weighted by its basis. Default 1.SmartStyle.shrinklayout/style.ts:86
top?LengthDistance from the parent’s top edge, for position: 'absolute'.SmartStyle.toplayout/style.ts:104
width?LengthBorder-box width. Default auto.SmartStyle.widthlayout/style.ts:90
wrap?"nowrap" | "wrap" | "wrap-reverse"Break items into several lines when they overflow. Default nowrap.SmartStyle.wraplayout/style.ts:48