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.

All text-like input helpers (text_field, email_field, password_field, etc.) render a bare <input> element by default. Pass ‘field: true` to wrap the input in a Fomantic <div class=“field”> with optional label, error, hint.

Usage:

# Bare input (no wrapper):
TextField(:email, placeholder: "E-mail address")

# Wrapped in <div class="field"> with auto-label:
TextField(:email, field: true)

# Inside an Input wrapper for icon styling:
Input(icon: "user", icon_position: "left") {
  TextField(:email, placeholder: "E-mail address")
}

Field options (only used when field: true):

label:        String  – override label text (false 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

Defined Under Namespace

Classes: Engine, ExamplesController, FomanticFormBuilder

Constant Summary collapse

VERSION =
"0.4.0"