Skip to main content
.gridColumnAlignment(guide: HorizontalAlignment): Component
guide
HorizontalAlignment
required
The horizontal alignment for the column. One of "leading", "center", or "trailing".

Support

Usage

Right-aligning a column

Grid([
    GridRow([
        Text("Name"),
        Text("Price")
            .gridColumnAlignment("trailing")
    ]),
    GridRow([
        Text("Widget"),
        Text("$9.99")
    ]),
    GridRow([
        Text("Gadget"),
        Text("$19.99")
    ])
])

Mixed column alignments

Grid([
    GridRow([
        Text("Left")
            .gridColumnAlignment("leading"),
        Text("Center")
            .gridColumnAlignment("center"),
        Text("Right")
            .gridColumnAlignment("trailing")
    ]),
    GridRow([
        Text("A"),
        Text("B"),
        Text("C")
    ])
])

Notes

  • This modifier is applied to a cell in any row and affects the alignment of the entire column across all rows. You only need to apply it to one cell per column.

See Also