Skip to main content

Frame

Creates an invisible frame around its child applying the given constraints.

modifier Frame
import { Frame, Rectangle } from ui

export var main = Rectangle(color: Color(0xFF000000)) with {
Frame(width: 100, height: 100)
}

Constructors

(width:height:​alignment)

Creates a fixed frame (minimum == maximum) around its child.

width: Float? = nil

Fixed width if set otherwise mirrors the childs width.

height: Float? = nil

Fixed height if set otherwise mirrors the childs height.

alignment: Alignment = Alignment.center

Sets the alignment of the child within the frame.

See Alignment

(min_width:max_width:min_height:max_height:​alignment)

Creates a frame with a lower and upper limit around the child.

min_width: Float? = nil

Lower limit for width if set.

max_width: Float? = nil

Upper limit for width if set.

min_height: Float? = nil

Lower limit for height if set.

max_height: Float? = nil

Upper limit for height if set.

alignment: Alignment = Alignment.center

Sets the alignment of the child within the frame.

Layout Behavior

The frame is always going to respect the constraints set on it. For unspecified dimensions it is going to mirror the childs size.