androidx.compose.foundation.layout
GridConfigurationScopeSince 1.11Experimental
Interface · from org.jetbrains.compose.foundation:foundation-layout:1.12.2
No hand-written docs yet.
Scope for configuring the structure of a Grid.
interface GridConfigurationScope : Density
Is a
Used by
Parameters that take a GridConfigurationScope.
Properties
constraints
val constraints: Constraints
The layout constraints passed to this Grid from its parent.
flow
val flow: GridFlow
The direction in which items that do not specify a position are placed. Defaults to GridFlow.Row.
frExperimental
val Int.fr: Fr
Creates an Fr unit from an Int.
val Float.fr: Fr
Creates an Fr unit from a Float.
val Double.fr: Fr
Creates an Fr unit from a Double.
Functions
column
fun column(size: Dp)
Defines a fixed-width column. Maps to GridTrackSize.Fixed.
fun column(weight: Fr)
Defines a flexible column. Maps to GridTrackSize.Flex.
fun column(percentage: Float)
Defines a percentage-based column. Maps to GridTrackSize.Percentage.
fun column(size: GridTrackSize)
Defines a new column track with the specified size.
row
fun row(size: Dp)
Defines a fixed-width row. Maps to GridTrackSize.Fixed.
fun row(weight: Fr)
Defines a flexible row. Maps to GridTrackSize.Flex.
fun row(percentage: Float)
Defines a percentage-based row. Maps to GridTrackSize.Percentage.
fun row(size: GridTrackSize)
Defines a new row track with the specified size.
areaSince 1.12
fun area(
areaId: Any,
row: Int = GridIndexUnspecified,
column: Int = GridIndexUnspecified,
rowSpan: Int = 1,
columnSpan: Int = 1,
)
Defines a named area or a 1-dimensional track within the grid by mapping an identifier to physical starting coordinates and spans.
fun area(
areaId: Any,
rows: IntRange,
columns: IntRange,
)
Defines a named area within the grid using explicit coordinate ranges.
gap
fun gap(all: Dp)
Sets both the row and column gaps (gutters) to all.
fun gap(row: Dp, column: Dp)
Sets independent gaps for rows and columns.
columnGap
fun columnGap(gap: Dp)
Sets the gap (gutter) size between columns.
rowGap
fun rowGap(gap: Dp)
Sets the gap (gutter) size between rows.
minmax
fun minmax(min: Dp, max: Fr): GridTrackSize
A flexible track with an explicitly defined minimum base size and a flexible maximum size. Conceptually, this behaves identically to the CSS Grid minmax(min, max) function.
Library docs
Scope for configuring the structure of a Grid.
This interface is implemented by the configuration block in Grid. It allows defining columns,
rows, and gaps.
The order in which column and row functions are called within the config block is
important. Tracks are added to the grid definition sequentially based on these calls. For
example, calling column(100.dp) twice defines two columns.
Gap configuration calls (gap, rowGap, columnGap) follow a "last-call-wins" policy for their
respective axes.