Class: UI::FieldTitle

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

Overview

Title - Phlex implementation

Title with label styling inside FieldContent. Uses FieldTitleBehavior concern for shared styling logic.

Examples:

Basic usage

render UI::Title.new { "Section Title" }

Instance Method Summary collapse

Methods included from FieldTitleBehavior

#field_title_classes, #field_title_html_attributes

Constructor Details

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

Returns a new instance of FieldTitle.

Parameters:

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



15
16
17
18
# File 'app/components/ui/field_title.rb', line 15

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

Instance Method Details

#view_template(&block) ⇒ Object



20
21
22
23
24
# File 'app/components/ui/field_title.rb', line 20

def view_template(&block)
  div(**field_title_html_attributes) do
    yield if block_given?
  end
end