Class: UI::FieldContentComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
FieldContentBehavior
Defined in:
app/view_components/ui/field_content_component.rb

Overview

FieldContentComponent - ViewComponent implementation

Flex column that groups control and descriptions. Uses FieldContentBehavior concern for shared styling logic.

Examples:

Basic usage

<%= render UI::FieldContentComponent.new do %>
  Content here
<% end %>

Instance Method Summary collapse

Methods included from FieldContentBehavior

#field_content_classes, #field_content_html_attributes

Constructor Details

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

Returns a new instance of FieldContentComponent.

Parameters:

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



17
18
19
20
# File 'app/view_components/ui/field_content_component.rb', line 17

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

Instance Method Details

#callObject



22
23
24
25
26
# File 'app/view_components/ui/field_content_component.rb', line 22

def call
   :div, **field_content_html_attributes do
    content
  end
end