Liking cljdoc? Tell your friends :D

district-ui-component-form

Build Status

Reagent forms library

License

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Installation

Add to dependencies

Clojars Project

Usage

(ns my.application
  (:require
    [district.ui.component.form.chip-input :refer [chip-input]]
    [district.ui.component.form.input :as inputs :refer [text-input textarea-input]]))

(defn form []
  (let [form-data (r/atom {})
        errors (reaction {:local (some-validation-fn)})]
    (fn []
      [:div
       [:h1 "test"]
       [text-input {:form-data form-data
                    :id :example.place/state
                    :errors errors}]
       [textarea-input {:form-data form-data
                        :id :example.place/city
                        :errors errors}]
       [chip-input {:form-data form-data
                    :chip-set-path [:tags]
                    :ac-options ["some tag"
                                 "some other tag"
                                 "a nice tag"
                                 "a beautiful tag"
                                 "something else"
                                 "another"]
                    :chip-render-fn chip-render}]])))

Validation errors are expected to mirror the shape of data, divided into :local and :remote. Local group is always on, where remote errors persists only until the inputs are touched.

Can you improve this documentation? These fine people already did:
Mike Konkov, fbielejec & Juan Monetta
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close