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

SizeScope

An interface that introduces size properties to a Style receiver scope interface.

Source set: Common
@ExperimentalFoundationStyleApi
interface SizeScope

An interface that introduces size properties to a Style receiver scope interface.

Functions

width

fun width(value: Dp)

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

This property is not inherited

Parameters

value The preferred width in Dp.

height

fun height(value: Dp)

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

This property is not inherited

Parameters

value The preferred height in Dp.

width

fun width(@FloatRange(from = 0.0, to = 1.0) fraction: Float)

Sets the width of the component to a fraction of the parent's available width. The specified width includes any padding.

This property is not inherited

Parameters

fraction The fraction of the available width (e.g., 0.5f for 50%).

height

fun height(@FloatRange(from = 0.0, to = 1.0) fraction: Float)

Sets the height of the component to a fraction of the parent's available height. The specified height includes any padding.

This property is not inherited

Parameters

fraction The fraction of the available height (e.g., 0.5f for 50%).

Last updated: