> Documentation index: https://developer.android.com/reference/llms.txt

# BackgroundAnnotation.Border

Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/BackgroundAnnotation.kt+class:androidx.compose.ui.text.BackgroundAnnotation.Border) Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01) Common/AllAndroid/JVM
- Cmn

  ```
  class BackgroundAnnotation.Border
  ```

*** ** * ** ***

Border stroke specification for `BackgroundAnnotation`.

Equivalent to `BorderStroke` in `androidx.compose.foundation` (which `ui-text` does not depend on), with an additional `ColorProducer` overload for draw-phase color animations.

Drawn as a centered stroke along the background contour: half of `width` extends outside the contour (past `spread`) and half overlaps inside the fill.

## Summary

| ### Public constructors |
|---|---|
| `Border(width: Dp, brush: Brush)` Creates a `Border` with a stroke `width` painted with a `brush`. | Cmn |
| `Border(width: Dp, color: Color)` Creates a `Border` with a stroke `width` and a solid `color`. | Cmn |
| `Border(width: Dp, colorProducer: ColorProducer)` Creates a `Border` with a stroke `width` whose color is resolved lazily on each draw pass via `colorProducer`, enabling border color animations without relayout. | Cmn |

| ### Public functions |
|---|---|---|
| `open operator Boolean` | `equals(other: Any?)` | Cmn |
| `open Int` | `hashCode()` | Cmn |
| `open String` | `toString()` | Cmn |

| ### Public properties |
|---|---|---|
| `Brush?` | `brush` stroke brush applied to the contour border, or `null` when constructed with `color` or `colorProducer` | Cmn |
| `Color` | `color` stroke color applied to the contour border, or `Color.Unspecified` when constructed with `colorProducer` or `brush` | Cmn |
| `ColorProducer?` | `colorProducer` deferred color producer evaluated during the draw phase, or `null` when constructed with `color` or `brush` | Cmn |
| `Dp` | `width` stroke width, or `Dp.Hairline` for a single-pixel hairline stroke | Cmn |

## Public constructors

### Border

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
Border(width: Dp, brush: Brush)
```

Creates a `Border` with a stroke `width` painted with a `brush`.

| Parameters |
|---|---|
| `width: Dp` | stroke width, or `Dp.Hairline` for a single-pixel hairline stroke |
| `brush: Brush` | stroke brush applied to the contour border |

### Border

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
Border(width: Dp, color: Color)
```

Creates a `Border` with a stroke `width` and a solid `color`.

| Parameters |
|---|---|
| `width: Dp` | stroke width, or `Dp.Hairline` for a single-pixel hairline stroke |
| `color: Color` | stroke color applied to the contour border |

### Border

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
Border(width: Dp, colorProducer: ColorProducer)
```

Creates a `Border` with a stroke `width` whose color is resolved lazily on each draw pass via `colorProducer`, enabling border color animations without relayout.

| Parameters |
|---|---|
| `width: Dp` | stroke width, or `Dp.Hairline` for a single-pixel hairline stroke |
| `colorProducer: ColorProducer` | deferred color producer evaluated during the draw phase |

## Public functions

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### brush

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val brush: Brush?
```

stroke brush applied to the contour border, or `null` when constructed with `color` or `colorProducer`

### color

Cmn

```
val color: Color
```

stroke color applied to the contour border, or `Color.Unspecified` when constructed with `colorProducer` or `brush`

### colorProducer

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val colorProducer: ColorProducer?
```

deferred color producer evaluated during the draw phase, or `null` when constructed with `color` or `brush`

### width

Cmn

```
val width: Dp
```

stroke width, or `Dp.Hairline` for a single-pixel hairline stroke