🌈 Create new beautiful Compose Gradients with our new wesite ->
Function

border

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

border

Source set: Common
public 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
public 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).

Content updated: