Widgets

/

layout

Mid

Fills its parent and centres its object.

Also written Center, Centre, Cen; layr format rewrites these to Mid.

Centring

Mid fills its parent and puts its object in the middle, on both axes. It is the shortest way to centre something.

LAYR
Container(
  .config(w: 280, h: 140, color: sunken, cornerRadius: 14)
  .obj(
    Mid(
      Container(
        .config(
          .border(color: line, width: 1)
          color: panel
          cornerRadius: 999
          padding: sym(x: 14, y: 6)
        )
        .obj(Text(.config(size: 13) .obj('Nothing here yet')))
      )
    )
  )
)

Config keys

KeyTypeDefaultMeaning
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).

Slots

  • .obj: one object, the default slot