Compose Unstyled 2.0 is out! Check the official announcement blog ->
Function

size

Sets the preferred width and height of the component.

size

Source set: Common
@ExperimentalFoundationStyleApi
fun SizeScope.size(width: Dp, height: Dp)

Sets the preferred width and height of the component. The actual size will also depend on the parent's constraints and other modifiers. The specified dimensions includes both contentPadding and externalPadding.

This property is not inherited

Parameters

width The preferred width in Dp.
height The preferred height in Dp.

size

Source set: Common
@ExperimentalFoundationStyleApi
fun SizeScope.size(value: Dp)

Sets the preferred width and height of the component to the same value. The actual size will also depend on the parent's constraints and other modifiers. The specified size includes any padding.

This property is not inherited

Parameters

value The preferred width and height in Dp.

size

Source set: Common
@ExperimentalFoundationStyleApi
fun SizeScope.size(value: DpSize)

Sets the preferred width and height of the component using a DpSize object. The actual size will also depend on the parent's constraints and other modifiers. The specified size includes any padding.

This property is not inherited

Parameters

value The preferred size.

Last updated: