border

fun Style.border(border: Border?): Style

Describes how a Border should be drawn around this component. Setting this property will cause the Component to be represented as a View at mount time if it wasn't going to already.


fun Style.border(width: Dimen, @ColorInt color: Int, radius: Dimen? = null, effect: BorderEffect? = null): Style

Applies a uniform border with the same width and color on all edges. This is a simplified API for the most common border use case.

Example:

Style.border(width = 2.dp, color = Color.Blue)
Style.border(width = 4.dp, color = Color.Red, radius = 8.dp)
Style.border(
width = 4.dp,
color = Color.Red,
effect = BorderEffect.dashed(floatArrayOf(10f, 5f), phase = 0f)
)

Parameters

width

the width to apply to all edges

color

the color to apply to all edges

radius

optional corner radius to apply to all corners

effect

optional border effect to apply to the entire border


Applies a border using a DSL-style builder for complex configurations.

This API provides a declarative way to configure borders with different properties per edge, custom corner radii, and effects.

Example:

Style.border {
all(width = 5.dp, color = Color.Blue, effect = BorderEffect.dashed(floatArrayOf(10f, 5f)))
cornerRadius(all = 10.dp)

top(color = Color.Red)
bottom(color = Color.Green)

cornerRadius(topLeft = 15.dp, topRight = 15.dp)
}

Parameters

block

the configuration block