Class: UI::LabelComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::LabelComponent
- Includes:
- LabelBehavior
- Defined in:
- app/view_components/ui/label_component.rb
Overview
LabelComponent - ViewComponent implementation
Accessible label for form inputs following shadcn/ui design patterns.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(for_id: nil, classes: "", **attributes) ⇒ LabelComponent
constructor
A new instance of LabelComponent.
Methods included from LabelBehavior
#label_classes, #label_html_attributes
Constructor Details
#initialize(for_id: nil, classes: "", **attributes) ⇒ LabelComponent
Returns a new instance of LabelComponent.
12 13 14 15 16 |
# File 'app/view_components/ui/label_component.rb', line 12 def initialize(for_id: nil, classes: "", **attributes) @for_id = for_id @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 |
# File 'app/view_components/ui/label_component.rb', line 18 def call content_tag :label, **label_html_attributes.merge(@attributes.except(:data)) do content end end |