Function

border

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

border

Source set: Common
@Deprecated(
    DeprecatedStyleProperty,
    replaceWith = ReplaceWith(""),
    level = DeprecationLevel.WARNING,
)
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
@Deprecated(
    DeprecatedStyleProperty,
    replaceWith = ReplaceWith(""),
    level = DeprecationLevel.WARNING,
)
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).
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: