- twitter bootstrap4
- nested forms support
- interface for i18n engines
- interface for validation engines
- clojure.spec integration
- complete test coverage
[reagent "0.7.0"]
[darkleaf/form "0.1.0"]
<!doctype html>
<html>
<head>
<title>Form</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<!-- add bootstrap styles -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous" />
</head>
<body>
<div class="container">
<div id="point">app mount point</div>
</div>
<script type="text/javascript" src="build/dev/main.js"></script>
</body>
</html>
(ns app
(:require
[reagent.core :as r]
[darkleaf.form.context :as ctx]
[darkleaf.form.bootstrap4 :as bootstrap]))
(defn i18n-error [path error]
"some logic")
(defn i18n-label [path]
"some logic")
(defn form [data errors]
;; i18n is optional
(let [f (ctx/build data errors update {:error i18n-error, :label i18n-label})]
[:form
[bootstrap/text f :some-attribute-name]]))
(def data {:some-attrubte-name "foo bar"})
(def errors {})
(r/render [form data errors]
(.getElementById js/document "point"))
Please see demo or tests for more examples.