androidx.compose.foundation.style

styleableSince 1.11Experimental

Function · from org.jetbrains.compose.foundation:foundation:1.12.2

No hand-written docs yet.

Modifier that creates a region that is styled by the given Style object for the component this Modifier is attached to.

With styleExperimental

fun Modifier.styleable(
    styleState: StyleState? = null,
    style: Style,
): Modifier

styleState: StyleState?Optional

Default: null

the state the style will use to decide which styles should be applied. If null is supplied, the style will only see the default state that will never be changed.

style: StyleRequired

the style to apply to the styleable region.

With stylesExperimental

fun Modifier.styleable(styleState: StyleState?, vararg styles: Style): Modifier

styles: StyleRequired

the styles to apply, in order, to the stylable region.

Same as above: styleState.

Library docs

Modifier that creates a region that is styled by the given Style object for the component this Modifier is attached to.

Apply styleable to creates a "styleable" component whose looks can be customized using the provided style. This should be called by a component that wishes to make itself styleable via a style: Style = Style parameter. If a component already takes a Style parameter, then that component internally is applying the styleable, and that Style parameter should be used instead of applying styleable again.

If styleable is added to a modifier chain that is after an another styleable, then the second region will wrap around the first. For example, if the two regions both supply padding then the padding will the sum of both regions.