GridContext

@ExperimentalCoroutinesApi
class GridContext(    styleParams: StyleParams,     selfAlignment: SelfAlignment,     target: StringBuilder) : StyleParams, SelfAlignment

This context interface offers functions to stylegrid layout-cells / child elements.

It does not configure the grid template / container itself. This should be done by GridLayout functions!

This interface offers all the inherited functions of SelfAlignment that corresponds to the CSS alignment module.

This class offers methods for binding a cell or a group of cells to the area template of the grid layout. This is done in two general ways:

  • provide specific names for a cell via the area function

  • provide patterns with start and end values referring to either names or counting values. This can be done by column or row.

You can define the position of a cell within the grid layout as follows:

// always need a component as child element like ``box``

// named cell approach
box({
grid { /* it == GridContext.() */
area { "CONTENT" }
}
})

// pattern approach (
box({
grid { /* it == GridContext.() */
row {
start { "CONTENT".start } // start at the beginning of the "content" area
end { "CONTENT".end } // occupy all of the "content" area
}
column {
start { "0" } // start at the beginning of the columns
end { span(2) } // occupy two columns
}
}
})

Parameters

styleParams

basic context scope interface

selfAlignment

common alignment functions for child elements

target

the defined output StringBuilder to write the generated CSS into

Constructors

Link copied to clipboard
fun GridContext(    styleParams: StyleParams,     selfAlignment: SelfAlignment,     target: StringBuilder)

Functions

Link copied to clipboard
open override fun alignSelf(value: SelfAlignItemsValues.() -> SelfAlignItemProperty)

This function sets the self-align property

Link copied to clipboard
fun area(value: () -> Property)

This function is used to set the name of an area part of the grid layout via the grid-area property.

Link copied to clipboard
fun column(value: GridRowColumnContext.() -> Unit)

This function is used to define the position within the columns of a grid for a child element using the grid-column property.

Link copied to clipboard
fun row(value: GridRowColumnContext.() -> Unit)

This function is used to define the position within the rows of a grid for a child element using the grid-row property.

Properties

Link copied to clipboard
open override val lgProperties: StringBuilder

collects the properties for large screens

Link copied to clipboard
open override val mdProperties: StringBuilder

collects the properties for middle-sized screens

Link copied to clipboard
open override val smProperties: StringBuilder

collects the properties for small screens

Link copied to clipboard
open override val xlProperties: StringBuilder

collects the properties for extra-large screens