🐑 A segmented control (tabs) library for Jetpack Compose 🐑
@Composable
fun Example() {
    var index by remember { mutableIntStateOf(0) }
    Column(
        Modifier.fillMaxSize().background(color = Color(0xFFFFFFFF))
    ) {
        Spacer(Modifier.height(64.dp))
        SegmentedControl(
            selectedIndex = index,
		    itemWidthMode = ItemWidthMode.Proportional,
            segmentedControlProperties = SegmentedControlPropertiesDefault.values().copy(offset = 16.dp, indicatorHorizontalPadding = 6.dp),
            onItemSelected = {
                index = it
            },
            items = listOf(
                SegmentedControlItem("Home"),
                SegmentedControlItem("Stats"),
                SegmentedControlItem("Transactions")
            )
        )
    }
}
You can find additional examples of usage and customization here.
- Add Jitpack Repositoryto yoursettings.gradlefile:
maven { url 'https://jitpack.io' }
- In your app’s build.gradlefile, add the dependency:
dependencies {
	implementation 'com.github.austin17ng:Austin_SegmentedControl:2.0.0'
}
object SegmentedControlPropertiesDefault {
    @Composable
    fun values() = SegmentedControlProperties(
        offset = 0.dp,
        containerBackgroundColor = Color(0x1F767680),
        containerPadding = 2.dp,
        containerCornerRadius = 9.dp,
        indicatorElevation = 12.dp,
        indicatorShadowColor = Color(0xFF000000),
        indicatorBorderWidth = 0.5.dp,
        indicatorBorderColor = Color(0x0A000000),
        indicatorColor = Color(0xFFFFFFFF),
        indicatorRadius = 7.dp,
        indicatorVerticalPadding = 6.dp,
        indicatorHorizontalPadding = 12.dp,
        animationDurationMillis = 500,
        labelFontSize = 12.sp,
        labelFontWeight = FontWeight.Medium,
        labelColor = Color(0xFF000000),
        easing = FastOutSlowInEasing,
    )
}
Feel free to contribute by submitting issues or pull requests. And please ensure that all pull requests are checked out from the main branch.
- Austin Tab –🐑 An adaptive and lightweight tab layout for Android 🐑.
Austin SegmentedControl is licensed under the MIT License.
