Skip to main content
.gridCellAnchor(anchor: UnitPoint): Component
anchor
UnitPoint
required
The anchor point within the cell. A UnitPoint where { x: 0, y: 0 } is the top-leading corner and { x: 1, y: 1 } is the bottom-trailing corner. You can also use string presets like "center", "topLeading", "bottomTrailing", etc.

Support

Usage

Positioning a cell at the top-leading corner

Grid([
    GridRow([
        Text("Top Left")
            .gridCellAnchor("topLeading"),
        Text("Center")
    ]),
    GridRow([
        Text("A"),
        Text("B")
    ])
])

Custom anchor point

Grid([
    GridRow([
        Circle()
            .frame({ width: 20, height: 20 })
            .foregroundStyle(Color("blue"))
            .gridCellAnchor({ x: 0.5, y: 0 })
    ])
])

See Also