Android 12 Developer Preview is here! Try it out, and give us your feedback!

Role

enum class Role
kotlin.Any
   ↳ kotlin.Enum<androidx.compose.ui.semantics.Role>
   ↳ androidx.compose.ui.semantics.Role

The type of user interface element. Accessibility services might use this to describe the element or do customizations. Most roles can be automatically resolved by the semantics properties of this element. But some elements with subtle differences need an exact role. If an exact role is not listed, SemanticsPropertyReceiver.role should not be set and the framework will automatically resolve it.

Summary

Enum values

This element is a button control.

This element is a Checkbox which is a component that represents two states (checked / unchecked).

This element is an image.

This element is a RadioButton which is a component to represent two states, selected and not selected.

This element is a Switch which is a two state toggleable component that provides on/off like options.

This element is a Tab which represents a single page of content using a text label and/or icon.

Inherited extension functions
From androidx.core.util
infix Range<T>
T.rangeTo(that: T)

Creates a range from this Comparable value to that.

Enum values

Button

enum val Button : Role

This element is a button control. Associated semantics properties for accessibility: SemanticsProperties.Disabled, SemanticsActions.OnClick

Checkbox

enum val Checkbox : Role

This element is a Checkbox which is a component that represents two states (checked / unchecked). Associated semantics properties for accessibility: SemanticsProperties.Disabled, SemanticsProperties.StateDescription, SemanticsActions.OnClick

Image

enum val Image : Role

This element is an image. Associated semantics properties for accessibility: SemanticsProperties.ContentDescription

RadioButton

enum val RadioButton : Role

This element is a RadioButton which is a component to represent two states, selected and not selected. Associated semantics properties for accessibility: SemanticsProperties.Disabled, SemanticsProperties.StateDescription, SemanticsActions.OnClick

Switch

enum val Switch : Role

This element is a Switch which is a two state toggleable component that provides on/off like options. Associated semantics properties for accessibility: SemanticsProperties.Disabled, SemanticsProperties.StateDescription, SemanticsActions.OnClick

Tab

enum val Tab : Role

This element is a Tab which represents a single page of content using a text label and/or icon. A Tab also has two states: selected and not selected. Associated semantics properties for accessibility: SemanticsProperties.Disabled, SemanticsProperties.StateDescription, SemanticsActions.OnClick