Components
Rating
A star rating component is a user interface element that allows users to provide feedback or rate items by selecting a number of stars, typically ranging from one to five.
Component Status Details
Status component contains a list of checks and completeness that has been tested and owned by each component
A star rating component is a user interface element that allows users to provide feedback or rate items by selecting a number of stars, typically ranging from one to five.

Variants
Legion has 3 variants for Rating :
- Empty Rating
- Half Rating
- Full Rating
Usage
The following is code to implement Rating component.
Rating
Empty Rating
val rating = remember { mutableStateOf(0.0) }LgnRatingBar(rating = rating.value,totalCount = 5) {rating.value = it}
Half Rating
val rating = remember { mutableStateOf(2.5) }LgnRatingBar(rating = rating.value,totalCount = 5) {rating.value = it}
Full Rating
val rating = remember { mutableStateOf(5.0) }LgnRatingBar(rating = rating.value,totalCount = 5) {rating.value = it}
State
Normal State
val rating = remember { mutableStateOf(3.5) }LgnRatingBar(modifier = Modifier.size(40.dp),rating = rating.value,totalCount = 5) {rating.value = it}
Disabled State
val rating = remember { mutableStateOf(3.5) }LgnRatingBar(modifier = Modifier.size(40.dp),rating = rating.value,totalCount = 5,enable = false) {rating.value = it}
Attributes
Parameters | Type | Description |
---|---|---|
rating | Double | Set value of Rating |
totalCount | Int | Set Total Count of Rating |
color | Color | Set Color of Rating |
enable | Boolean | Set Enable or Disable of Rating |
halfIcon | ImageVector | Set Half Icon of Rating |
fullIcon | ImageVector | Set Full Icon of Rating |
emptyIcon | ImageVector | Set Empty Icon of Rating |
onRatingChange | Function | Set Action When Rating change |