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

border

Sets a solid border for the component with the specified width and color.

border

Source set: Common
@ExperimentalFoundationStyleApi
fun BorderScope.border(width: Dp, color: Color)

Sets a solid border for the component with the specified width and color. The border is drawn on top of the background and the padded content. The border itself does not contribute to the component's layout size (width/height).

Specifying a Dp.Unspecified width will remove the border.

Specifying a Dp.Hairline or 0.dp width will create 1 pixel border regardless of density.

This property is not inherited

Parameters

width The width of the border.
color The color of the border.

border

Source set: Common
@ExperimentalFoundationStyleApi
fun BorderScope.border(width: Dp, brush: Brush)

Sets a border for the component with the specified width and brush. The border is drawn on top of the background and the padded content. The border itself does not contribute to the component's layout size (width/height).

Specifying a Dp.Unspecified width will remove the border.

Specifying a Dp.Hairline or 0.dp width will create 1 pixel border regardless of density.

This property is not inherited

Parameters

width The width of the border.
brush The brush to paint the border (e.g., for gradients).

Last updated: