Module: UI::FieldTitleBehavior
- Included in:
- FieldTitle, FieldTitleComponent
- Defined in:
- app/behaviors/ui/field_title_behavior.rb
Overview
FieldTitleBehavior
Shared behavior for FieldTitle component across ERB, ViewComponent, and Phlex implementations. FieldTitle provides title with label styling inside FieldContent.
Instance Method Summary collapse
-
#field_title_classes ⇒ Object
Returns combined CSS classes for the field title.
-
#field_title_html_attributes ⇒ Object
Returns HTML attributes for the field title element.
Instance Method Details
#field_title_classes ⇒ Object
Returns combined CSS classes for the field title
18 19 20 21 22 23 |
# File 'app/behaviors/ui/field_title_behavior.rb', line 18 def field_title_classes classes_value = respond_to?(:classes, true) ? classes : @classes base = "flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50" TailwindMerge::Merger.new.merge([base, classes_value].compact.join(" ")) end |
#field_title_html_attributes ⇒ Object
Returns HTML attributes for the field title element
9 10 11 12 13 14 15 |
# File 'app/behaviors/ui/field_title_behavior.rb', line 9 def field_title_html_attributes attributes_value = respond_to?(:attributes, true) ? attributes : @attributes { "data-slot": "field-label", class: field_title_classes }.merge(attributes_value).compact end |