Skip to main content
Give us your valuable feedback

It will help us understand how we can serve you better

Give feedback

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.

banner-Rating
Component Status Details

Status component contains a list of checks and completeness that has been tested and owned by each component

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

Status

Resources

Upcoming Upcoming

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 :

  1. Empty Rating
  2. Half Rating
  3. 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

ParametersTypeDescription
ratingDoubleSet value of Rating
totalCountIntSet Total Count of Rating
colorColorSet Color of Rating
enableBooleanSet Enable or Disable of Rating
halfIconImageVectorSet Half Icon of Rating
fullIconImageVectorSet Full Icon of Rating
emptyIconImageVectorSet Empty Icon of Rating
onRatingChangeFunctionSet Action When Rating change