{"id":18383544,"url":"https://github.com/devscast/validable","last_synced_at":"2025-03-16T08:06:22.246Z","repository":{"id":45451398,"uuid":"433571968","full_name":"devscast/validable","owner":"devscast","description":"An easy-to-use text field validator supporting Compose. Multiplatform","archived":false,"fork":false,"pushed_at":"2025-02-17T00:22:18.000Z","size":1014,"stargazers_count":71,"open_issues_count":6,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-02T09:11:51.596Z","etag":null,"topics":["android","cmp","compose-multiplatform","jetpack-compose","kmp","kotlin","kotlin-library","kotlin-multiplatform"],"latest_commit_sha":null,"homepage":"https://devscast.github.io/validable/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devscast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-30T20:12:19.000Z","updated_at":"2025-01-29T16:51:30.000Z","dependencies_parsed_at":"2023-12-01T22:25:04.203Z","dependency_job_id":"178fcd1b-c343-4b85-aef7-78ef0a51cf8c","html_url":"https://github.com/devscast/validable","commit_stats":{"total_commits":77,"total_committers":5,"mean_commits":15.4,"dds":0.1298701298701299,"last_synced_commit":"72595e9f66e7262fea2263e0aff4e97ec9248f10"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fvalidable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fvalidable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fvalidable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devscast%2Fvalidable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devscast","download_url":"https://codeload.github.com/devscast/validable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243841211,"owners_count":20356443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","cmp","compose-multiplatform","jetpack-compose","kmp","kotlin","kotlin-library","kotlin-multiplatform"],"created_at":"2024-11-06T01:11:48.645Z","updated_at":"2025-03-16T08:06:22.212Z","avatar_url":"https://github.com/devscast.png","language":"Kotlin","readme":"# validable\n\n![Maven Central Version](https://img.shields.io/maven-central/v/tech.devscast/validable?color=blue)\n[![build](https://github.com/devscast/validable/actions/workflows/build.yaml/badge.svg)](https://github.com/devscast/validable/actions/workflows/build.yaml)\n\nValidable is an extensible library that simplifies text field validation for Jetpack Compose and\nCompose Multiplatform by providing abstraction and reusable validation logic.\n\nThis is what it looks like :\n\n\u003cimg src=\"screenshots/inputscreen.png?raw=true\" width=\"459\" alt=\"Welcome screen\"\u003e\n\n```kotlin  \n@Composable\nfun MyScreen() {\n\n    val emailField = remember { EmailValidable() }\n\n    // pass all fields to the withValidable method\n    val validator = rememberValidator(emailField)\n\n\n    TextField(\n        value = emailField.value,\n        onValueChange = { emailField.value = it }, // update the text  \n        isError = emailField.hasError(), // check if the field is not valid    \n    )\n\n    AnimatedVisibility(visible = emailField.hasError()) {\n\n        Text(\n            text = emailField.errorMessage ?: \"\",\n            modifier = Modifier.fillMaxWidth(),\n            style = LocalTextStyle.current.copy(color = MaterialTheme.colors.error)\n        )\n\n    }\n\n    Button(\n        // a state to check if all fields are valid, without submitting the form\n        enabled = validator.isValid,\n        onClick = {\n            validator.validate {\n                // will be executed if all fields are valid \n                Toast.makeText(context, \"All fields are valid\", Toast.LENGTH_SHORT).show()\n            }\n        }\n    ) {\n        Text(text = \"Submit\")\n    }\n}  \n```\n\n## Gradle setup\n\nInclude the **validable** dependency in your module `build.gradle` or `build.gradle.kts` :\n\n```kotlin\ndependencies {\n    implementation(\"tech.devscast:validable:\u003cversion\u003e\")\n}\n```\n\nThe latest version\nis ![Maven Central Version](https://img.shields.io/maven-central/v/tech.devscast/validable?color=blue)\n\n## For full documentation, check out [https://devscast.github.io/validable](https://devscast.github.io/validable)\n\n## Contributing\n\nWe'd love contributions !\n\nWe will also try to tag any issues on\nour [issue tracker](https://github.com/devscast/validable/issues) that we'd love help with, so\nif you just want to dip in, go have a look.\n\nIf you do want to contribute to this project, we have a [code of conduct](CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevscast%2Fvalidable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevscast%2Fvalidable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevscast%2Fvalidable/lists"}