Row

Creates a horizontal layout that arranges children from left to right.

Basic Usage

Row([]any{
    Text("Left"),
    Text("Right"),
})

Options

Option Type Description Example
RowSpacing float32 Sets the space between children in dp (default: 8) RowSpacing(16)
RowMainAxis MainAxisAlignment Sets alignment along the horizontal axis RowMainAxis(MainAxisCenter)

Main Axis Alignment Values

Value Description
MainAxisStart Align children to the left (default)
MainAxisCenter Center children horizontally
MainAxisEnd Align children to the right
MainAxisSpaceBetween Distribute space between children
MainAxisSpaceAround Distribute space around children
MainAxisSpaceEvenly Distribute space evenly

Examples

// Basic row with default spacing
Row([]any{
    Text("Item 1"),
    Text("Item 2"),
    Text("Item 3"),
})

// Row with custom spacing
Row([]any{
    Button("Save"),
    Button("Cancel"),
}, RowSpacing(16))

// Row with no spacing
Row([]any{
    Text("No"),
    Text("Space"),
}, RowSpacing(0))

// Row with centered alignment
Row([]any{
    Button("Centered"),
}, RowMainAxis(MainAxisCenter))

// Row with space between
Row([]any{
    Text("Left"),
    Text("Right"),
}, RowMainAxis(MainAxisSpaceBetween))

// Row with flexible children using Spacer
Row([]any{
    Text("Left"),
    Spacer(),
    Text("Right"),
})

// Row with Expanded widget
Row([]any{
    Text("Label:"),
    Expanded(TextField(Hint("Enter value"))),
})