# ChipSection.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/ChipSection.java+class:androidx.car.app.model.ChipSection.Builder) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

*** ** * ** ***


```
public final class ChipSection.Builder extends Section.BaseBuilder<Chip, ChipSection.Builder>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.car.app.model.Section.BaseBuilder](https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder)\<[Chip](https://developer.android.com/reference/androidx/car/app/model/Chip), [ChipSection.Builder](https://developer.android.com/reference/androidx/car/app/model/ChipSection.Builder)\> ||
|   | ↳ | [androidx.car.app.model.ChipSection.Builder](https://developer.android.com/reference/androidx/car/app/model/ChipSection.Builder) |

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/car/app/model/ChipSection.Builder#Builder()()` Creates a new instance of the builder. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/ChipSection` | `https://developer.android.com/reference/androidx/car/app/model/ChipSection.Builder#build()()` Constructs the `https://developer.android.com/reference/androidx/car/app/model/ChipSection` defined by this builder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/ChipSection.Builder` | `https://developer.android.com/reference/androidx/car/app/model/ChipSection.Builder#setStyle(androidx.car.app.model.ChipStyle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/ChipStyle style)` Sets the style for all chips in this section. |

### Inherited methods

From [androidx.car.app.model.Section.BaseBuilder](https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder) `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html
https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder#addItem(T)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T item)`

Adds an item to this section, appending to the existing list of items.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html
https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder#clearItems()()`

Delete all items in this section.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html
https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder#setItems(java.util.List<T>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<T> items)`

Sets the items for this section, overwriting any other previously set items.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html
https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder#setNoItemsMessage(androidx.car.app.model.CarText)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarText noItemsMessage)`

Sets or clears the optional message to display in this section when there are 0 items added to it.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html
https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder#setNoItemsMessage(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html noItemsMessage)`

Sets or clears the optional message to display in this section when there are 0 items added to it.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html
https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder#setOnItemVisibilityChangedListener(androidx.car.app.model.ItemList.OnItemVisibilityChangedListener)(
@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/ItemList.OnItemVisibilityChangedListener onItemVisibilityChangedListener
)`

Sets the `https://developer.android.com/reference/androidx/car/app/model/ItemList.OnItemVisibilityChangedListener` to call when the visible items in this `https://developer.android.com/reference/androidx/car/app/model/Section` changes.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html
@https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 9)
@https://developer.android.com/reference/androidx/car/app/annotations/ExperimentalCarApi
https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder#setSectionHeader(androidx.car.app.model.SectionHeader)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/SectionHeader sectionHeader)`

Sets the `https://developer.android.com/reference/androidx/car/app/model/SectionHeader` for this section.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html
https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder#setTitle(androidx.car.app.model.CarText)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarText title)`

Sets or clears the optional title that appears above the items in this section.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html
https://developer.android.com/reference/androidx/car/app/model/Section.BaseBuilder#setTitle(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html title)`

Sets or clears the optional title that appears above the items in this section.

## Public constructors

### Builder

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

```
public Builder()
```

Creates a new instance of the builder.

## Public methods

### build

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

```
public @NonNull ChipSection build()
```

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

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the section does not contain at least one item. |

### setStyle

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

```
public @NonNull ChipSection.Builder setStyle(@NonNull ChipStyle style)
```

Sets the style for all chips in this section.

Any fields not explicitly set here or in the individual chip styling of `https://developer.android.com/reference/androidx/car/app/model/Chip.Builder#setStyle(androidx.car.app.model.ChipStyle)` will fall back to host defaults. If the colors do not meet the contrast requirements, the host will set the chip styling to defaults based on the `https://developer.android.com/reference/androidx/car/app/model/Chip.Builder#setSelected(boolean)` state.

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