Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To apply a bottom border exclusively in Jetpack Compose, use the Modifier.border() function with the following parameters:

  • width: The width of the border.
  • color: The color of the border.
  • shape: The shape of the border, which can be either RectangleShape or RoundedCornerShape.

To apply a bottom border, set the border modifier with BorderStroke to the View, with size parameter describing the width of the border:

Box(modifier = Modifier
    .height(100.dp)
    .width(100.dp)
    .border(border = BorderStroke(2.dp, Color.Red), shape = RectangleShape, shapeAppearance = null))

This will add a border with a width of 2dp and a red color to the bottom of the view.