# 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)

*** ** * ** ***


```
public final class ChipStyle.Builder
```

<br />

*** ** * ** ***

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

## Summary

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

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/ChipStyle` | `https://developer.android.com/reference/androidx/car/app/model/ChipStyle.Builder#build()()` Constructs the `https://developer.android.com/reference/androidx/car/app/model/ChipStyle` defined by this builder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/ChipStyle.Builder` | `https://developer.android.com/reference/androidx/car/app/model/ChipStyle.Builder#setBackgroundColor(androidx.car.app.model.CarColor)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarColor backgroundColor)` Sets the background color of the chip. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/ChipStyle.Builder` | `https://developer.android.com/reference/androidx/car/app/model/ChipStyle.Builder#setContentColor(androidx.car.app.model.CarColor)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarColor contentColor)` Sets the content color of the chip. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/ChipStyle.Builder` | `https://developer.android.com/reference/androidx/car/app/model/ChipStyle.Builder#setOutlineColor(androidx.car.app.model.CarColor)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarColor outlineColor)` Sets the stroke color of the chip. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/ChipStyle.Builder` | `https://developer.android.com/reference/androidx/car/app/model/ChipStyle.Builder#setShape(androidx.car.app.model.Shape)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/Shape shape)` Sets the shape of the chip. |

## Public constructors

### Builder

Added in 1.8.0

```
public Builder()
```

## Public methods

### build

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

```
public @NonNull ChipStyle build()
```

Constructs the `https://developer.android.com/reference/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)

```
public @NonNull ChipStyle.Builder setBackgroundColor(@NonNull CarColor backgroundColor)
```

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/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)

```
public @NonNull ChipStyle.Builder setContentColor(@NonNull CarColor contentColor)
```

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/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)

```
public @NonNull ChipStyle.Builder setOutlineColor(@NonNull CarColor outlineColor)
```

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)

```
public @NonNull ChipStyle.Builder setShape(@NonNull Shape shape)
```

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` |