{"id":19604664,"url":"https://github.com/victorvoid/formap","last_synced_at":"2025-04-27T19:32:40.144Z","repository":{"id":62432692,"uuid":"195713168","full_name":"victorvoid/formap","owner":"victorvoid","description":"A reagent library to build awesome dynamic forms. 🔨","archived":false,"fork":false,"pushed_at":"2019-07-08T21:29:03.000Z","size":24,"stargazers_count":14,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T02:22:02.609Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victorvoid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-08T01:03:56.000Z","updated_at":"2020-02-10T22:43:51.000Z","dependencies_parsed_at":"2022-11-01T21:15:30.723Z","dependency_job_id":null,"html_url":"https://github.com/victorvoid/formap","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorvoid%2Fformap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorvoid%2Fformap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorvoid%2Fformap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorvoid%2Fformap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorvoid","download_url":"https://codeload.github.com/victorvoid/formap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251196056,"owners_count":21550893,"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":[],"created_at":"2024-11-11T09:37:46.692Z","updated_at":"2025-04-27T19:32:39.521Z","avatar_url":"https://github.com/victorvoid.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# formap\n[![license](https://badgen.now.sh/badge/license/MIT)](./LICENSE)\n\n\n![](https://github.com/victorvoid/formap/blob/master/public/img/formap.svg)\n\nA reagent library to build awesome dynamic forms. 🔨\n\n[![Clojars Project](http://clojars.org/formap/latest-version.svg)](https://clojars.org/formap)\n\n\n## Installation\n\nTo use formap in an existing project you add this to your dependencies in project.clj\n\n```\n[formap \"0.x.x\"]\n```\n\n## Why ?\n\nThe main objective is to build a form by a literal map that describe all fields.\n\n- ♥️ Building form using literal map.\n- 🔫 Validators support.\n- 📄 Meta class in fields (touched|untouched|valid|invalid|etc).\n\n## Documentation\n\nFirst you need to create a literal map that describe a form and use it for build.\n\n\n```cljs\n(ns app.pages.signin\n  (:require\n   [reagent.core :as r]\n   [app.utils.validators :refer [username-or-email? password?]]\n   [formap.core :refer [build-form]]))\n\n(def signin-fields\n  {:fields [{:name \"login\"\n             :placeholder \"Username or Email\"\n             :class \"input\"\n             :autoFocus true\n             :required \"Username or Email is required\"\n             :validators [username-or-email?]}\n\n            {:name \"password\"\n             :placeholder \"Password\"\n             :type \"password\"\n             :required \"Password is required\"\n             :validators [password?]}]})\n\n(defn login []\n  [build-form {:experience signin-fields\n               :class \"myform\"\n               :on-submit #(js/console.log %)} ;;{:login \"Text typed\" :password \"Password typed\"}\n    [:button \"Sign in\"]])\n```\n\n![](https://i.imgur.com/OZ81oA0.gif)\n\n\n### Validators\nYou can create your own validator and set a message error.\n\n```cljs\n(ns app.pages.signin\n  (:require\n   [reagent.core :as r]\n   [formap.core :refer [build-form]]))\n\n(defn- match-regex?\n  \"Check if the string matches the regex\"\n  [v regex]\n  (boolean (re-matches regex v)))\n  \n(defn username-validate\n  [input]\n  (if (or (nil? input) (empty? input))\n    true\n    (match-regex? input #\"^([a-zA-Z0-9.]+@){0,1}([a-zA-Z0-9.])+$\")))\n\n(def username?\n  {:validate username-validate\n   :message \"Username invalid.\"})\n\n(def signin-fields\n  {:fields [{:name \"login\"\n             :placeholder \"Username\"\n             :class \"input\"\n             :autoFocus true\n             :required \"Username is required\"\n             :validators [username?]}\n\n            {:name \"password\"\n             :placeholder \"Password\"\n             :type \"password\"\n             :required \"Password is required\"}]})\n\n(defn login []\n  [build-form {:experience signin-fields\n               :class \"myform\"\n               :on-submit #(js/console.log %)}\n    [:button \"Sign in\"]])\n```\n\nLicense\n-------\n\nThe code is available under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorvoid%2Fformap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorvoid%2Fformap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorvoid%2Fformap/lists"}