Class: UI::SelectLabelComponent

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

Overview

LabelComponent - ViewComponent implementation

Label for a group of select items.

Examples:

Basic usage

<%= render UI::LabelComponent.new { "North America" } %>

Instance Method Summary collapse

Methods included from SelectLabelBehavior

#select_label_classes, #select_label_html_attributes

Constructor Details

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

Returns a new instance of SelectLabelComponent.

Parameters:

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

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



14
15
16
17
# File 'app/view_components/ui/select_label_component.rb', line 14

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

Instance Method Details

#callObject



19
20
21
# File 'app/view_components/ui/select_label_component.rb', line 19

def call
   :div, content, **select_label_html_attributes.deep_merge(@attributes)
end