Module: Ui
- Defined in:
- app/helpers/ui/fomantic_form_builder.rb,
lib/ui.rb,
lib/ui/engine.rb,
lib/ui/version.rb,
lib/rails_active_ui.rb,
app/controllers/ui/examples_controller.rb
Overview
FomanticFormBuilder
A Rails FormBuilder wrapping every helper in Fomantic-UI markup.
Usage in a view:
<%= form_with model: @user, builder: FomanticFormBuilder do |f| %>
<%= f.text_field :name %>
<%= f.email_field :email, required: true %>
<%= f.select :role, [['Admin', 'admin'], ['User', 'user']], dropdown: true %>
<%= f.check_box :terms, label: 'I agree to the Terms and Conditions' %>
<%= f.fields_group(equal_width: true) do %>
<%= f.text_field :first_name %>
<%= f.text_field :last_name %>
<% end %>
<%= f.submit 'Save', color: 'green' %>
<% end %>
Field options (shared across all helpers):
label: String – override label text (nil to suppress label)
required: Boolean – adds "required" class and asterisk
disabled: Boolean – adds "disabled" class
readonly: Boolean – adds "read-only" class
inline: Boolean – label sits beside the input
width: String – Fomantic grid column word, e.g. "six", "three"
error: String – error message; adds "error" class + inline message
warning: String – warning message; adds "warning" class + inline message
hint: String – rendered as a small grey note beneath the input
field_class: String – extra classes on the wrapping .field div
input_class: String – extra classes on the input element itself
Defined Under Namespace
Classes: Engine, ExamplesController, FomanticFormBuilder
Constant Summary collapse
- VERSION =
"0.3.7"