Widgets

/

layout

Column

Lays objects out top to bottom.

Also written Col; layr format rewrites these to Column.

A settings group

A Column lays its objects out top to bottom with a gap. xAlign aligns them across the column, yAlign distributes them down it, and align sets both.

LAYR
Column(
  .config(
    w: 300
    .border(color: line, width: 1)
    color: panel
    cornerRadius: 12
    gap: 2
    padding: all(6)
  )
  Container(
    .config(w: fill, color: sunken, cornerRadius: 8, padding: all(12))
    .obj(Text('Account'))
  )
  Container(.config(w: fill, padding: all(12)) .obj(Text('Notifications')))
  Container(.config(w: fill, padding: all(12)) .obj(Text('Privacy')))
)

Filling the height

Inside a Column with a height, h: fill shares the space that is left, like flex: 1.

LAYR
Column(
  .config(
    w: 300
    h: 240
    color: sunken
    cornerRadius: 12
    gap: 8
    padding: all(8)
  )
  Container(.config(w: fill, h: 40, color: panel, cornerRadius: 8))
  Container(.config(w: fill, h: fill, color: accent, cornerRadius: 8))
  Container(.config(w: fill, h: 40, color: panel, cornerRadius: 8))
)

Config keys

KeyTypeDefaultMeaning
w (width)len | fill | hugWidth: a length, fill (share the remaining space) or hug (fit content, default).
h (height)len | fill | hugHeight: a length, fill or hug (default).
size (s)sizeWidth and height together: size: 200 or size: (200, 120).
minW (minWidth)lenMinimum width.
maxW (maxWidth)lenMaximum width.
minH (minHeight)lenMinimum height.
maxH (maxHeight)lenMaximum height.
aspect (aspectRatio)numAspect ratio (width / height), e.g. 16/9.
color (bg, background, colorBG)paintBackground paint: a colour or gradient.
padding (pad)insetsSpace inside the object.
cornerRadius (radius, borderRadius, corner)radiusCorner radius: one length or only(topLeft: 8, …).
borderWidthlenBorder width.
borderColorcolorBorder colour.
borderAlignin | mid | outinWhere the border sits relative to the edge: in, mid or out.
borderStylesolid | dashed | dottedsolidBorder line style.
borderSidesall | top | bottom | left | right | x | yallWhich sides draw the border (inside the box).
shadowshadowDrop shadow(s): shadow(y: 4, blur: 12, color: black.alpha(20%)).
clipboolClip children to the object's bounds (and corner radius).
zintStacking order among siblings.
margininsetsSpace outside the object: all(8), sym(x: 8, y: 4), only(top: 8).
opacitynumOpacity from 0 to 1.
hide (hidden)boolRemoves the object from layout and the accessibility tree.
shrinknum1Shrink priority when space runs out. Lower shrinks first; 0 never shrinks.
flexnum1Share of remaining space for fill sizes.
cursorauto | pointer | text | grab | grabbing | move | notAllowed | crosshair | nonePointer cursor.
className (class)txtExtra CSS class names: styling hooks for your own stylesheet (hover rules, third-party CSS).
align (alignment)alignBoth axes at once, e.g. align: mid or align: bottomRight; xAlign and yAlign override one axis.
xAlign (crossAxisAlignment)axisstartHorizontal alignment of children.
yAlign (mainAxisAlignment)axisstartVertical distribution down the column.
gap (spacing)lenSpace between children.
overflowauto | wrap | stack | scroll | clip | shrink | warn | errorautoWhat happens when content does not fit. auto adapts deterministically (see Layout & Adaptation).
stackAtlenRow only: the width below which the row stacks into a column (computed automatically when omitted).
reverseboolReverse the visual order.

Group .border(align, color, width, style, sides): Border settings grouped: .border(align: in, color: #0d0d0d, width: 2).

Slots

  • .objs: several objects, the default slot

Events

.on(...) accepts tap, press, hover, hoverEnd, focus, blur, key, drag, swipe, mount, unmount, visible.