https://github.com/austin17ng/austin_segmentedcontrol
A segmented control (tabs) library for Jetpack Compose
https://github.com/austin17ng/austin_segmentedcontrol
android jetpack-compose jetpack-compose-library kotlin segmentedcontrol tablayout
Last synced: 10 months ago
JSON representation
A segmented control (tabs) library for Jetpack Compose
- Host: GitHub
- URL: https://github.com/austin17ng/austin_segmentedcontrol
- Owner: austin17ng
- License: mit
- Created: 2025-04-04T16:20:32.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-17T12:43:44.000Z (about 1 year ago)
- Last Synced: 2025-07-03T05:03:03.457Z (10 months ago)
- Topics: android, jetpack-compose, jetpack-compose-library, kotlin, segmentedcontrol, tablayout
- Language: Kotlin
- Homepage:
- Size: 3.21 MB
- Stars: 32
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Austin Segmented Control
:sheep: A segmented control (tabs) library for Jetpack Compose :sheep:

## Examples
### A basic example
```
@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")
)
)
}
}
```
### Other examples
You can find additional examples of usage and customization [here](app/src/main/java/me/austinng/austinsegmentedcontrol/MainActivity.kt).
## Installation
1. Add `Jitpack Repository` to your `settings.gradle` file:
```
maven { url 'https://jitpack.io' }
```
2. In your app’s `build.gradle` file, add the dependency:
```
dependencies {
implementation 'com.github.austin17ng:Austin_SegmentedControl:2.0.0'
}
```
## Default properties
```
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,
)
}
```
## Contributing
Feel free to contribute by submitting issues or pull requests. And please ensure that all pull requests are checked out from the `main` branch.
## Related Projects
- [Austin Tab](https://github.com/austin17ng/austin-tab) –🐑 An adaptive and lightweight tab layout for Android 🐑.
## License
Austin SegmentedControl is licensed under the MIT License.