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
We don't use color as the only visual tool to convey information.
The component’s structure and properties include relevant options such as variant, style, size, orientation, optional iconography, decorations, selection, error state, etc. The title is the component name that uses the frame base component template. The base component name contains: .Base & "Component Name" if there is more than one. All component properties use the Legion foundation.
We can change all the parts that are connected to the component base. The inside of the base component remains connected to the master component. All variant options are not damaged when we change from one to another. Overriding changes to components will not reset other variants.
Component's already has component specs documentation.
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 |