RatingInput

fun RatingInput(@IntRange(from = 0, to = 5) value: Int, onRatingChanged: (Int) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, stateDescription: (Int) -> String = { "$it stars" }, allowSemantics: Boolean = true, testTag: String? = null)

A rating input component that allows the user to select a rating from 0 to 5. This component can have it's value changed either by a tap on the star or dragging horizontally.

Parameters

value

The current rating value Int.

onRatingChanged

The callback that is called when the rating value changes.

modifier

The modifier to be applied to the layout.

enabled

Whether the rating input is enabled.

stateDescription

Lambda to generate the accessibility state description from the current value.

allowSemantics

Whether to enable semantic properties for accessibility. Set to false when using the component as part of a larger component that handles its own semantics to avoid duplicate announcements.

testTag

Optional tag for UI testing, if defined then all stars will have a test tag in the format "$testTag Star $index" where index is 0-4.