https://github.com/joelkanyi/sain
[サイン] A Compose Multiplatform library for capturing and exporting signatures as ImageBitmap with customizable options. Perfect for electronic signature, legal documents and more.
https://github.com/joelkanyi/sain
compose-multiplatform digital-signature documents e-sign e-signature electronic-signature jetpack-compose kotlin signature signature-pad
Last synced: about 1 month ago
JSON representation
[サイン] A Compose Multiplatform library for capturing and exporting signatures as ImageBitmap with customizable options. Perfect for electronic signature, legal documents and more.
- Host: GitHub
- URL: https://github.com/joelkanyi/sain
- Owner: joelkanyi
- License: apache-2.0
- Created: 2023-01-29T08:27:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-04-25T12:48:26.000Z (about 1 month ago)
- Last Synced: 2026-04-25T14:25:52.149Z (about 1 month ago)
- Topics: compose-multiplatform, digital-signature, documents, e-sign, e-signature, electronic-signature, jetpack-compose, kotlin, signature, signature-pad
- Language: Kotlin
- Homepage: https://joelkanyi.github.io/sain/
- Size: 30.7 MB
- Stars: 230
- Watchers: 4
- Forks: 10
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- mobile-awesome - sain - A Compose Multiplatform library for capturing and exporting signatures as ImageBitmap with customizable options. Perfect for electronic signature, legal documents and more. (Multiplatform / Android samples)
README
[](https://search.maven.org/artifact/io.github.joelkanyi/sain)



[](https://opensource.org/licenses/Apache-2.0)
# Sain (サイン)
A Compose Multiplatform library for capturing and exporting signatures as `ImageBitmap` with customizable options. Perfect for electronic signatures, legal documents, and more.
**Supported platforms:** Android · iOS · Desktop (JVM) · Web (JS) · Web (WasmJS)
See the [project's website](https://joelkanyi.github.io/sain/) for full documentation.
## Features
- Capture signatures as `ImageBitmap` on all platforms
- Customizable signature color, thickness, pad color, shape, and border
- Optional guideline with configurable style, padding, and dash pattern
- Hint text when the signature pad is empty
- State management with `rememberSignatureState()` for persistence
- Clear and complete actions via `SignatureAction`
## Installation
Add the Maven Central repository if it is not already there:
```kotlin
repositories {
mavenCentral()
}
```
### Multiplatform Projects
Add the dependency to your `commonMain` source set:
```kotlin
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("io.github.joelkanyi:sain:")
}
}
}
}
```
### Android Projects
Add the dependency to your app's `build.gradle.kts`:
```kotlin
dependencies {
implementation("io.github.joelkanyi:sain:")
}
```
### Gradle Version Catalog
Add the following to your `libs.versions.toml`:
```toml
[versions]
sain = ""
[libraries]
sain = { module = "io.github.joelkanyi:sain", version.ref = "sain" }
```
Then add the dependency in your `build.gradle.kts`:
```kotlin
dependencies {
implementation(libs.sain)
}
```
## Quick Start
Add the `Sain` composable to your project:
```kotlin
var imageBitmap by remember { mutableStateOf(null) }
Sain(
signatureHeight = 250.dp,
signaturePadColor = Color.White,
signatureBorderStroke = BorderStroke(
width = .5.dp,
color = MaterialTheme.colorScheme.onSurface,
),
signaturePadShape = RoundedCornerShape(8.dp),
onComplete = { signatureBitmap ->
if (signatureBitmap != null) {
imageBitmap = signatureBitmap
} else {
println("Signature is empty")
}
},
) { action ->
Row(
modifier = Modifier
.padding(top = 16.dp)
.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(16.dp),
) {
Button(
modifier = Modifier.weight(1f),
onClick = {
imageBitmap = null
action(SignatureAction.CLEAR)
},
) {
Text("Clear")
}
Button(
modifier = Modifier.weight(1f),
onClick = {
action(SignatureAction.COMPLETE)
},
) {
Text("Complete")
}
}
}
```
## Preview
| Android | iOS | Desktop |
|:-------:|:---:|:-------:|
|
|
|
|
| Web (JS) | Web (WasmJS) |
|:--------:|:------------:|
|
|
|
## License
```
Copyright 2023 Joel Kanyi
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.
```