# ChipStyle.Builder

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/model/ChipStyle.java+class:androidx.car.app.model.ChipStyle.Builder) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

*** ** * ** ***


```
class ChipStyle.Builder
```

<br />

*** ** * ** ***

A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder#Builder()()` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder#build()()` Constructs the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle` defined by this builder. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder#setBackgroundColor(androidx.car.app.model.CarColor)(backgroundColor: https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor)` Sets the background color of the chip. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder#setContentColor(androidx.car.app.model.CarColor)(contentColor: https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor)` Sets the content color of the chip. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder#setOutlineColor(androidx.car.app.model.CarColor)(outlineColor: https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor)` Sets the stroke color of the chip. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle.Builder#setShape(androidx.car.app.model.Shape)(shape: https://developer.android.com/reference/kotlin/androidx/car/app/model/Shape)` Sets the shape of the chip. |

## Public constructors

### Builder

Added in 1.8.0

```
Builder()
```

## Public functions

### build

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

```
fun build(): ChipStyle
```

Constructs the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ChipStyle` defined by this builder.

### setBackgroundColor

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

```
fun setBackgroundColor(backgroundColor: CarColor): ChipStyle.Builder
```

Sets the background color of the chip.

If the background color is not set, a host default color will be used, depending on the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Chip#isSelected()` state.

@throws NullPointerException if `backgroundColor` is `null`

### setContentColor

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

```
fun setContentColor(contentColor: CarColor): ChipStyle.Builder
```

Sets the content color of the chip.

If the content color is not set, a host default color will be used, depending on the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Chip#isSelected()` state.

The content color is used for the text and icons within the chip.

This color is contrast checked against the background color. If it does not meet a minimum contrast threshold, this color will be ignored and a host-provided fallback color will be used.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `contentColor` is `null` |

### setOutlineColor

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

```
fun setOutlineColor(outlineColor: CarColor): ChipStyle.Builder
```

Sets the stroke color of the chip.

If the content color is not set, a host default color will be used.

@throws NullPointerException if `strokeColor` is `null`

### setShape

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
fun setShape(shape: Shape): ChipStyle.Builder
```

Sets the shape of the chip.

If the shape is not set, a host default shape will be used.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `shape` is `null` |