RatingBar is a library for implementing a rating bar in Compose Multiplatform. This library allows you to easily add a rating bar to both Android and iOS applications. Of course, it can be used not only with Compose Multiplatform, but also with Android's Compose.
- Works on both Android and iOS
- Customizable rating bar
- Easy integration
Add the following dependency to your build.gradle.kts
:
dependencies {
implementation("io.github.hiroaki404.ratingbar:$version")
}
var rating by remember { mutableFloatStateOf(3f) }
RatingBar(
value = rating,
onValueChange = { rating = it },
)
RatingBar can be customized as follows:
Please see the KDoc for details.
var rating by remember { mutableFloatStateOf(3.5f) }
RatingBar(
value = rating,
onValueChange = { rating = it },
numOfSteps = 10,
stepSize = StepSize.HALF,
spaceBetween = 4.dp,
modifier = modifier.background(Color.Black),
)
You can use images other than stars as well.
var rating by remember { mutableFloatStateOf(3.5f) }
RatingBar(
value = rating,
onValueChange = { rating = it },
ratingContent = {
Icon(
imageVector = Icons.Rounded.Call,
contentDescription = null,
tint = defaultStarColor,
)
},
inactiveContent = {
Icon(
imageVector = Icons.Rounded.Call,
contentDescription = null,
tint = defaultInactiveStarColor,
)
},
)
Copyright 2025 hiroaki404
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.