Class: UI::FieldSet

Inherits:
Phlex::HTML
  • Object
show all
Includes:
FieldSetBehavior
Defined in:
app/components/ui/field_set.rb

Overview

Set - Phlex implementation

Semantic fieldset container for grouped fields. Uses FieldSetBehavior concern for shared styling logic.

Examples:

Basic usage

render UI::Set.new do
  render UI::Legend.new { "Contact Information" }
end

Instance Method Summary collapse

Methods included from FieldSetBehavior

#field_set_classes, #field_set_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ FieldSet

Returns a new instance of FieldSet.

Parameters:

  • classes (String) (defaults to: "")

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



17
18
19
20
# File 'app/components/ui/field_set.rb', line 17

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



22
23
24
25
26
# File 'app/components/ui/field_set.rb', line 22

def view_template(&block)
  fieldset(**field_set_html_attributes) do
    yield if block_given?
  end
end