# Tab

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

*** ** * ** ***


```
@CarProtocol
@RequiresCarApi(value = 6)
public final class Tab implements Content
```

<br />

*** ** * ** ***

Represents a tab with a title and an image. `https://developer.android.com/reference/androidx/car/app/model/Tab` instances are used by TabTemplate to display tab headers.

## Summary

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

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/car/app/model/Tab#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/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/model/Tab#getContentId()()` Returns the content ID associated with the tab. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarIcon` | `https://developer.android.com/reference/androidx/car/app/model/Tab#getIcon()()` Returns the image to display in the tab. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/TabStyle` | `@https://developer.android.com/reference/androidx/car/app/annotations/ExperimentalCarApi @https://developer.android.com/reference/androidx/car/app/annotations/RequiresCarApi(value = 9) https://developer.android.com/reference/androidx/car/app/model/Tab#getStyle()()` Returns the `https://developer.android.com/reference/androidx/car/app/model/TabStyle` of the container or `null` if not set. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/model/CarText` | `https://developer.android.com/reference/androidx/car/app/model/Tab#getTitle()()` Returns the title of the tab. |
| `int` | `https://developer.android.com/reference/androidx/car/app/model/Tab#hashCode()()` |
| `@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/Tab#toString()()` |

## Public methods

### equals

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

### getContentId

```
public @NonNull String getContentId()
```

Returns the content ID associated with the tab.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/model/Tab.Builder#setContentId(java.lang.String)` |   |

### getIcon

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

```
public @NonNull CarIcon getIcon()
```

Returns the image to display in the tab.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/model/Tab.Builder#setIcon(androidx.car.app.model.CarIcon)` |   |

### getStyle

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

```
@ExperimentalCarApi
@RequiresCarApi(value = 9)
public @Nullable TabStyle getStyle()
```

Returns the `https://developer.android.com/reference/androidx/car/app/model/TabStyle` of the container or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/model/Tab.Builder#setStyle(androidx.car.app.model.TabStyle)` |   |

### getTitle

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

```
public @NonNull CarText getTitle()
```

Returns the title of the tab.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/model/Tab.Builder#setTitle(java.lang.CharSequence)` |   |

### hashCode

```
public int hashCode()
```

### toString

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