reforms.core
Core controls and helpers.
button
(button & args)
Button. See http://getbootstrap.com/css/#buttons
Arguments:
[attrs] label on-click [:in-progress
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
- label - button label; a string or Hiccup/Sablono style template
- on-click - lambda to handle clicks
- :in-progress - true to show an indicator that a background action is in progress and disable the button
- :disabled - true to disable the button
button-default
(button-default & args)
button-group
(button-group & args)
Button group.
Arguments:
[attrs] button-1 … button-n
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
button-primary
(button-primary & args)
checkbox
(checkbox & args)
Checkbox. See http://getbootstrap.com/css/#checkboxes-and-radios
Arguments:
[attrs] label cursor korks value [:valid?
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
- label - the label; a string or Hiccup/Sablono style template
- cursor, korks - data to bind to
- :inline - (optional) if true renders the control inline
- :valid? - (optional) if false shows a validation error; internal
- :validation-error-fn - (optional) lambda
-> ; internal
color
(color & args)
Color input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
date
(date & args)
Date input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
datetime
(datetime & args)
Datetime input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
datetime-local
(datetime-local & args)
Datetime-local input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
(email & args)
Email input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
form
(form & args)
A form. See http://getbootstrap.com/css/#forms
Arguments:
[attrs] element1 … element2
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
- contents - (optional) the contained elements
Examples:
(form [:div "Contents go here"])
(form {:style {:background-color "red"}} [:div "Contents go here"])
form-buttons
(form-buttons & buttons)
Auto-aligning form buttons.
Arguments:
button-1 … button-n
get-options
group-title
(group-title & args)
A title for a logical group of controls.
Arguments:
[attrs] title [:tag
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
- title - the title; a string or Hiccup/Sablono style template
- tag - (optional) name of the tag to use, e.g. :h4
html5-input
(html5-input type & args)
An HTML5-compatible input. Used internally to implement most input types.
Arguments:
type [attrs] [label] cursor korks [:in-progress BOOL] [:warn-fn LAMBDA] [help RENDERABLE] [:inline BOOL] [:large BOOL] [:placeholder STRING] [:valid? BOOL] [:validation-error-fn LAMBDA]
- type - input type
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
- label - (optional) the label; a string or Hiccup/Sablono style template
- cursor, korks - data to bind to
- :in-progress - (optional) if true shows progress spinner
- :warn-fn - (optional) a predicate invoked on the input’s value; if it returns a RENDERABLE, it will be shown as a warning label
- :help - (optional) help block
- :inline - (optional) if true renders the control inline
- :large - (optional) if true the input will have a larger size
- :placeholder - (optional) the input’s placeholder text
- :valid? - (optional) if false shows a validation error; internal
- :validation-error-fn - (optional) lambda
-> ; internal
RENDERABLE - string, hiccup-style markup or a React component.
month
(month & args)
Month input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
number
(number & args)
Number input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
panel
(panel & args)
A panel. See http://getbootstrap.com/components/#panels
Arguments:
[attrs] title [:close
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
- title - panel title; a string or Hiccup/Sablono style template
- :close - (optional) lambda to call when panel is closed; when the option is set, the panel shows a close icon (FontAwesome by default)
- contents - (optional) the contained elements
Examples:
(panel "A simple panel"
[:div "Contents go here"])
(panel {:class "my-special-panel"} "My special panel" :close #(js/alert "closed")
[:div "Contents go here"])
password
(password & args)
Password input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
radio
(radio & args)
Radio button. See http://getbootstrap.com/css/#checkboxes-and-radios
Arguments:
[attrs] label cursor korks value [:valid?
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
- label - the label; a string or Hiccup/Sablono style template
- cursor, korks - data to bind to
- :inline - (optional) if true renders the control inline
- :valid? - (optional) if false shows a validation error; internal
- :validation-error-fn - (optional) lambda
-> ; internal
search
(search & args)
Search input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
select
(select & args)
Select element. See http://getbootstrap.com/css/#selects
Arguments:
[attrs] label cursor korks options [:on-change
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
- label - (optional) the label; a string or Hiccup/Sablono style template
- cursor, korks - data to bind to
- options - a vector containing options and their labels (see examples below)
- :on-change - (optional) lambda to call on selection
Examples:
(f/select "Select" data [:select]
[[:option1 "Option 1"] [:option2 "Option 2"] [:option3 "Option 3"]])
(f/select {:class "my-special-selector"} "Select" data [:select]
:on-change #(js/alert @data)
[[:option1 "Option 1"] [:option2 "Option 2"] [:option3 "Option 3"]])
set-options!
Sets configuration options. See reforms.core.options.
Arguments:
- options - a map specifying options to merge into current option map.
Note: It intelligently merges options; see the example below.
Example:
;; Example initial configuration:
{:form {:horizontal true
:attrs {:style {:background-color "yellow"}}}}
;; Setting options
(set-options! {:form {:attrs {:style {:border "1px solid black"}}}{)
;; Resulting configuration:
{:form {:horizontal true
:attrs {:style {:background-color "yellow"}}}
spinner
(spinner & args)
A spinner.
Arguments:
[attrs]
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
tel
(tel & args)
Tel input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
text
(text & args)
Text input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
textarea
(textarea & args)
Textarea element. See http://getbootstrap.com/css/#textarea
Arguments:
[attrs] [label] cursor korks [opts]
- attrs - (optional) attributes handed over to React (see https://github.com/r0man/sablono#html-attributes)
- label - (optional) the label; a string or Hiccup/Sablono style template
- cursor, korks - data to bind to
- opts - see html5-input
Examples:
(f/textarea "Textarea" "A placeholder" data [:some-text])
(f/textarea {:rows 8} "Textarea" "A placeholder" data [:some-text] :inline true)
time
(time & args)
Time input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
url
(url & args)
Url input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
week
(week & args)
Week input. See http://getbootstrap.com/css/#inputs
Arguments:
See html5-input
Important: May be unsupported by some popular browsers. For compatilibity and available attributes see http://www.w3schools.com/html/html_form_input_types.asp
with-options
macro
(with-options options & body)
Specify options for a block.
** Important:** Use only inside a component and never outside om.core/build or om.core/root because it uses dynamic binding. To specify global options use [set-options!].
Example:
(with-options {:form {:horizontal true}}
(form
(text ...)
(button ...))