Widgets

/

layout

Scaffold

The page's viewport box: full height, safe areas, scroll policy and the overflow boundary.

Also written Frame; layr format rewrites these to Scaffold.

Scaffold is the page's frame: full height, the safe areas, the scroll policy and the three places a page is made of. .bar stays at the top while the page scrolls, .body is the content, and .footer sits at the end. textColor is the colour every Text uses unless it sets its own.

LAYROpen in playground
Page(
  .name(Home)
  .route('/')
  Scaffold(
    .config(color: canvas, textColor: ink)
    .bar(
      Row(
        .config(
          w: fill
          .border(color: line, width: 1, sides: bottom)
          color: panel
          padding: sym(x: 20, y: 14)
          xAlign: between
          yAlign: mid
        )
        Text(.config(weight: semibold) .obj('Studio'))
        Text(.config(color: muted) .obj('Sign in'))
      )
    )
    .body(
      Column(
        .config(w: fill, gap: 12, padding: all(20))
        Text(.config(size: 28, type: h1, weight: semibold) .obj('Book a room'))
        Text(
          .config(color: muted)
          .obj(
            'The bar is sticky: on a long page it stays on top as you scroll.'
          )
        )
        Container(.config(w: fill, h: 180, color: panel, cornerRadius: 14))
        Container(.config(w: fill, h: 180, color: panel, cornerRadius: 14))
      )
    )
    .footer(
      Container(
        .config(w: fill, padding: all(20))
        .obj(Text(.config(size: 13, color: faint) .obj('© Studio')))
      )
    )
  )
)

Config keys

KeyTypeDefaultMeaning
color (colorBG, bg, background)paintPage background.
textColor (fg, foreground)colorThe page's text colour: every Text without its own color uses it. Without it, text follows the colour scheme (dark text on light, light on dark).
scrolly | noneyy scrolls the page (default); none makes a fixed, app-like screen.
fitwidth | contain | cover | canvasDesign Scale fit: width (default for scrolling), contain (default for fixed screens), cover or canvas.
paddinginsetsSpace inside the page.
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

  • .bar: one object
  • .body: one object, the default slot
  • .footer: one object