---
title: "border"
description: "Sets a solid border for the component with the specified width and color."
type: "function"
lastmod: "2026-05-20T01:13:53.230511Z"
---
## API Reference

### border

> Source set: Common

```kotlin
@ExperimentalFoundationStyleApi
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

```kotlin
@ExperimentalFoundationStyleApi
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). |
