https://github.com/popovanton0/kira
🎛️ Automatically generates UI which allows users to call any function (including composable ones) with any parameter values. Useful for building demo screens in playground apps of design systems
https://github.com/popovanton0/kira
android annotation-processor code-generation demo-app design-system jetpack-compose kotlin ksp playground-app
Last synced: 20 days ago
JSON representation
🎛️ Automatically generates UI which allows users to call any function (including composable ones) with any parameter values. Useful for building demo screens in playground apps of design systems
- Host: GitHub
- URL: https://github.com/popovanton0/kira
- Owner: popovanton0
- License: apache-2.0
- Created: 2022-05-07T12:03:39.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-18T20:18:25.000Z (almost 2 years ago)
- Last Synced: 2024-11-07T17:50:46.151Z (6 months ago)
- Topics: android, annotation-processor, code-generation, demo-app, design-system, jetpack-compose, kotlin, ksp, playground-app
- Language: Kotlin
- Homepage:
- Size: 4.14 MB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - popovanton0/kira - 🎛️ Automatically generates UI which allows users to call any function (including composable ones) with any parameter values. Useful for building demo screens in playground apps of design systems (Kotlin)
README
# Kira
[](https://www.repostatus.org/#suspended)
[](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.2.0)Kira is an Android library that defines a Kotlin DSL (similar to
[androidx.preference](https://developer.android.com/guide/topics/ui/settings)) for creating UI that allows users to call
any function (including `@Composable` ones) with any parameter values.Kira also includes annotation-processor `kira-processor` that __✨automagically✨__ generates UI for functions using the
DSL.Library is particularly useful for building demo screens for UI components in playground apps of various design systems.
## Example
```kotlin
@Kira
@Composable
fun TextCard(
text: String,
isRed: Boolean,
skill: Skill?,
food: Food,
) = TODO()
```Generated code (only a portion):
```kotlin
kira(TextCardScope()) {
text = string(paramName = "text", defaultValue = "Lorem")
isRed = boolean(paramName = "isRed", defaultValue = false)
skill = nullableEnum(paramName = "skill", defaultValue = null)
food = enum(paramName = "food")
injector {
TextCard(
text = text.currentValue(),
isRed = isRed.currentValue(),
skill = skill.currentValue(),
food = food.currentValue(),
)
}
}
```Screenshot of the UI demo screen:
![]()
## Demo Video
## Getting Started
[](https://jitpack.io/#popovanton0/kira)
Add the following code to your project's _root_ `build.gradle` file:
```groovy
repositories {
maven { url "https://jitpack.io" }
}
```Next, add the dependency below to your _module_'s `build.gradle` file:
```gradle
dependencies {
implementation "com.github.popovanton0:kira:LATEST_VERSION"
ksp "com.github.popovanton0.kira:kira-processor:LATEST_VERSION"
}
```## Usage
Examples are in
the [source code](https://github.com/popovanton0/kira/blob/master/app/src/main/java/com/popovanton0/kira/demo/MainActivity.kt)
.### Basic
```kotlin
TODO()
```