https://github.com/alorma/Compose-Settings
Compose Multiplatform #Compose Settings library
https://github.com/alorma/Compose-Settings
android android-library compose compose-multiplatform settings
Last synced: 8 months ago
JSON representation
Compose Multiplatform #Compose Settings library
- Host: GitHub
- URL: https://github.com/alorma/Compose-Settings
- Owner: alorma
- License: mit
- Created: 2021-04-22T15:33:05.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-25T09:54:07.000Z (9 months ago)
- Last Synced: 2025-04-07T00:09:49.704Z (8 months ago)
- Topics: android, android-library, compose, compose-multiplatform, settings
- Language: Kotlin
- Homepage: https://alorma.github.io/Compose-Settings/
- Size: 6.73 MB
- Stars: 498
- Watchers: 5
- Forks: 30
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-list - alorma/Compose-Settings - Compose Multiplatform #Compose Settings library (Kotlin)
- awesome - Compose Settings
README
# Compose Settings - Multiplatform



[](https://github.com/alorma/Compose-Settings/actions/workflows/main.yml)
[](https://central.sonatype.com/namespace/com.github.alorma.compose-settings)
[](https://alorma.github.io/Compose-Settings/dokka)
### Preview
This library provides a set of **Settings** like composable items to help android *Jetpack Compose*
developers build complex settings screens without all the boilerplate.
**Ui tiles**
| Component | Screenshot |
|-------------------------------------------------------|----------------------------------------------------------------------------------|
| [SettingsMenuLink](#SettingsMenuLink) |
|
| [SettingsCheckbox](#SettingsCheckbox) |
|
| [SettingsTriStateCheckbox](#SettingsTriStateCheckbox) |
|
| [SettingsRadioButton](#SettingsRadioButton) |
|
| [SettingsSwitch](#SettingsSwitch) |
|
| [SettingsGroup](#SettingsGroup) |
|
**Ui tiles expanded**
| Component | Screenshot |
|-----------------------------------|----------------------------------------------------------------|
| [SettingsSlider](#SettingsSlider) |
|
## Install
```
##// groovy
implementation 'com.github.alorma.compose-settings:ui-tiles:$version'
implementation 'com.github.alorma.compose-settings:ui-tiles-extended:$version'
[...]
// kotlin DSL
implementation("com.github.alorma.compose-settings:ui-tiles:$version")
implementation("com.github.alorma.compose-settings:ui-tiles-extended:$version")
[...]
// Catalog versions:
[versions]
compose-settings = "{{libVersion}}"
[libraries]
composeSettings-ui = { group = "com.github.alorma.compose-settings", name = "ui-tiles", version.ref = "compose-settings" }
composeSettings-ui-extended = { group = "com.github.alorma.compose-settings", name = "ui-tiles-extended", version.ref = "compose-settings" }
```
## Usage
##### SettingsMenuLink:
```kotlin
SettingsMenuLink(
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
action = { IconButton() },
onClick = { ... },
)
```

##### SettingsCheckbox:
```kotlin
SettingsCheckbox(
state = false / true,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onCheckedChange = { newState: Boolean -> },
)
```

##### SettingsTriStateCheckbox:
```kotlin
SettingsTriStateCheckbox(
state = false / true / null,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onCheckedChange = { newState: Boolean -> },
)
```

##### SettingsRadioButton:
```kotlin
SettingsRadioButton(
state = false / true,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onClick = { },
)
```

##### SettingsSwitch:
```kotlin
SettingsSwitch(
state = false / true,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onCheckedChange = { newState: Boolean -> },
)
```

##### SettingsSlider:
```kotlin
SettingsSlider(
value = x.xf,
valueRange = X.f..Y.f,
steps = X,
title = { Text(text = "Setting title") },
subtitle = { Text(text = "Setting subtitle") },
modifier = Modifier,
enabled = false / true,
icon = { Icon(...) },
onValueChange = { newValue: Float -> },
)
```

##### SettingsGroup
> Updates on `enabled` will be reflected on it's internal components unless you change their `enabled` state manually.
```kotlin
SettingsGroup(
modifier = Modifier,
enabled = false / true,
title = { Text(text = "SettingsGroup") },
contentPadding = PaddingValues(16.dp),
) {
SettingsMenuLink(...)
SettingsCheckbox(...)
SettingsSwitch(...)
...
}
```