# Chip

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

*** ** * ** ***


```
@ExperimentalCarApi
@CarProtocol
@RequiresCarApi(value = 9)
public final class Chip implements Item
```

<br />

*** ** * ** ***

A Chip is a toggle-like button with text and/or leading/trailing icon(s).

Chips can, for example, be used to filter items in a `https://developer.android.com/reference/androidx/car/app/model/SectionedItemTemplate` when clicked on. A chip's style, content, and selected state can be changed in response to a user click.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/car/app/model/Chip.Builder` A builder of `https://developer.android.com/reference/androidx/car/app/model/Chip`. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/car/app/model/Chip#equals(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html other)` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarIcon` | `https://developer.android.com/reference/androidx/car/app/model/Chip#getEndIcon()()` Returns the end icon of the chip, or `null` if not set. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/OnClickDelegate` | `https://developer.android.com/reference/androidx/car/app/model/Chip#getOnClickDelegate()()` Returns the `https://developer.android.com/reference/androidx/car/app/model/OnClickDelegate` to be called when the chip is clicked. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarIcon` | `https://developer.android.com/reference/androidx/car/app/model/Chip#getStartIcon()()` Returns the start icon of the chip, or `null` if not set. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/ChipStyle` | `https://developer.android.com/reference/androidx/car/app/model/Chip#getStyle()()` Returns the style of the chip, or `null` if not set. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarText` | `https://developer.android.com/reference/androidx/car/app/model/Chip#getTitle()()` Returns the title of the chip, or `null` if not set. |
| `int` | `https://developer.android.com/reference/androidx/car/app/model/Chip#hashCode()()` |
| `boolean` | `https://developer.android.com/reference/androidx/car/app/model/Chip#isSelected()()` Returns whether the chip is selected. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/model/Chip#toString()()` |

## Public methods

### equals

```
public boolean equals(@Nullable Object other)
```

### getEndIcon

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

```
public @Nullable CarIcon getEndIcon()
```

Returns the end icon of the chip, or `null` if not set.

### getOnClickDelegate

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

```
public @Nullable OnClickDelegate getOnClickDelegate()
```

Returns the `https://developer.android.com/reference/androidx/car/app/model/OnClickDelegate` to be called when the chip is clicked.

### getStartIcon

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

```
public @Nullable CarIcon getStartIcon()
```

Returns the start icon of the chip, or `null` if not set.

### getStyle

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

```
public @Nullable ChipStyle getStyle()
```

Returns the style of the chip, or `null` if not set.

### getTitle

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

```
public @Nullable CarText getTitle()
```

Returns the title of the chip, or `null` if not set.

### hashCode

```
public int hashCode()
```

### isSelected

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

```
public boolean isSelected()
```

Returns whether the chip is selected.

### toString

```
public @NonNull String toString()
```