Class: UI::InputGroupTextComponent

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

Overview

InputGroupTextComponent - ViewComponent implementation

A text element for displaying static text within input groups. Uses InputGroupTextBehavior concern for shared styling logic.

Examples:

Simple text

<%= render UI::InputGroupTextComponent.new do %>
  @
<% end %>

With icon

<%= render UI::InputGroupTextComponent.new do %>
  <svg class="size-4">...</svg>
  Username
<% end %>

Instance Method Summary collapse

Methods included from InputGroupTextBehavior

#input_group_text_classes, #input_group_text_html_attributes

Constructor Details

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

Returns a new instance of InputGroupTextComponent.

Parameters:

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



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

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

Instance Method Details

#callObject



28
29
30
31
32
# File 'app/view_components/ui/input_group_text_component.rb', line 28

def call
   :span, **input_group_text_html_attributes do
    content
  end
end