validable
2.0.0-alpha02indexedExtensible library simplifies text field validation, offering abstraction and reusable logic for UI frameworks. Features include error handling and validation state management. No longer maintained.
Extensible library simplifies text field validation, offering abstraction and reusable logic for UI frameworks. Features include error handling and validation state management. No longer maintained.
[!NOTE]
We want to inform you that Validable will no longer be maintained. The project has reached its end of life, and there will be no further updates or support. Thank you to everyone who used and contributed to Validable!
Validable is an extensible library that simplifies text field validation for Jetpack Compose and Compose Multiplatform by providing abstraction and reusable validation logic.
This is what it looks like :
@Composable
fun MyScreen() {
val emailField = remember { EmailValidable() }
// pass all fields to the withValidable method
validator = rememberValidator(emailField)
TextField(
value = emailField.value,
onValueChange = { emailField.value = it },
isError = emailField.hasError(),
)
AnimatedVisibility(visible = emailField.hasError()) {
Text(
text = emailField.errorMessage ?: ,
modifier = Modifier.fillMaxWidth(),
style = LocalTextStyle.current.copy(color = MaterialTheme.colors.error)
)
}
Button(
enabled = validator.isValid,
onClick = {
validator.validate {
Toast.makeText(context, , Toast.LENGTH_SHORT).show()
}
}
) {
Text(text = )
}
}
Include the validable dependency in your module build.gradle or build.gradle.kts :
dependencies {
implementation("tech.devscast:validable:<version>")
}
The latest version
is
We'd love contributions !
We will also try to tag any issues on our issue tracker that we'd love help with, so if you just want to dip in, go have a look.
If you do want to contribute to this project, we have a code of conduct.
Surfaced from shared tags and platforms — no rankings paid for.