Class: UI::Label
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::Label
- Includes:
- LabelBehavior
- Defined in:
- app/components/ui/label.rb
Overview
Label - Phlex implementation
Accessible label for form inputs following shadcn/ui design patterns. Uses LabelBehavior concern for shared styling logic.
Instance Method Summary collapse
-
#initialize(for_id: nil, classes: "", **attributes) ⇒ Label
constructor
A new instance of Label.
- #view_template(&block) ⇒ Object
Methods included from LabelBehavior
#label_classes, #label_html_attributes
Constructor Details
#initialize(for_id: nil, classes: "", **attributes) ⇒ Label
Returns a new instance of Label.
19 20 21 22 23 |
# File 'app/components/ui/label.rb', line 19 def initialize(for_id: nil, classes: "", **attributes) @for_id = for_id @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
25 26 27 28 29 |
# File 'app/components/ui/label.rb', line 25 def view_template(&block) label(**label_html_attributes.deep_merge(@attributes)) do yield if block_given? end end |