# ModifiersBuilders.Semantics

Artifact: [androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/ModifiersBuilders.java+class:androidx.wear.protolayout.ModifiersBuilders.Semantics) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


```
@RequiresSchemaVersion(major = 1, minor = 0)
public final class ModifiersBuilders.Semantics
```

<br />

*** ** * ** ***

A modifier for an element which has accessibility semantics associated with it. This should generally be used sparingly, and in most cases should only be applied to the top-level layout element or to Clickables.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Semantics.Builder` Builder for `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Semantics` |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/TypeBuilders.StringProp` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Semantics#getContentDescription()()` Gets the content description associated with this element. |
| `int` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Semantics#getRole()()` Gets the type of user interface element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/TypeBuilders.StringProp` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Semantics#getStateDescription()()` Gets the localized state description of the semantics node. |
| `boolean` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Semantics#isHeading()()` Gets whether this element should be marked as heading for accessibility. |
| `@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/wear/protolayout/ModifiersBuilders.Semantics#toString()()` |

## Public methods

### getContentDescription

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @Nullable TypeBuilders.StringProp getContentDescription()
```

Gets the content description associated with this element. This will be dictated when the element is focused by the screen reader.

While this field is statically accessible from 1.0, it's only bindable since version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).

### getRole

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public int getRole()
```

Gets the type of user interface element. Accessibility services might use this to describe the element or do customizations.

### getStateDescription

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @Nullable TypeBuilders.StringProp getStateDescription()
```

Gets the localized state description of the semantics node. For example: "on" or "off". This will be dictated when the element is focused by the screen reader.

This field is bindable and will use the dynamic value (if set).

### isHeading

Added in [1.4.2](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.4.2)

```
public boolean isHeading()
```

Gets whether this element should be marked as heading for accessibility.

### toString

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