border

Compose Modifier

Common
fun Modifier.border(border: BorderStroke, shape: Shape = RectangleShape) =
    border(width = border.width, brush = border.brush, shape = shape)

Modify element to add border with appearance specified with a border and a shape and clip it.

Parameters

borderBorderStroke class that specifies border appearance, such as size and color
shapeshape of the border
Common
fun Modifier.border(width: Dp, color: Color, shape: Shape = RectangleShape) =
    border(width, SolidColor(color), shape)

Modify element to add border with appearance specified with a width, a color and a shape and clip it.

Parameters

widthwidth of the border. Use Dp.Hairline for a hairline border.
colorcolor to paint the border with
shapeshape of the border
Common
fun Modifier.border(width: Dp, brush: Brush, shape: Shape) =
    this then BorderModifierNodeElement(width, brush, shape)

Modify element to add border with appearance specified with a width, a brush and a shape and clip it.

Parameters

widthwidth of the border. Use Dp.Hairline for a hairline border.
brushbrush to paint the border with
shapeshape of the border