Class: Panda::Core::Admin::FormSectionComponent
- Defined in:
- app/components/panda/core/admin/form_section_component.rb
Overview
Standardized form section component for grouping related form fields. Provides a consistent heading style for form sections without the heavy visual weight of PanelComponent.
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#border_top ⇒ Object
readonly
Returns the value of attribute border_top.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #content_classes ⇒ Object
- #default_attrs ⇒ Object
- #description_classes ⇒ Object
- #heading_classes ⇒ Object
-
#initialize(title:, description: nil, icon: nil, border_top: true, **attrs) ⇒ FormSectionComponent
constructor
A new instance of FormSectionComponent.
Constructor Details
#initialize(title:, description: nil, icon: nil, border_top: true, **attrs) ⇒ FormSectionComponent
Returns a new instance of FormSectionComponent.
33 34 35 36 37 38 39 |
# File 'app/components/panda/core/admin/form_section_component.rb', line 33 def initialize(title:, description: nil, icon: nil, border_top: true, **attrs) @title = title @description = description @icon = icon @border_top = border_top super(**attrs) end |
Instance Attribute Details
#border_top ⇒ Object (readonly)
Returns the value of attribute border_top.
41 42 43 |
# File 'app/components/panda/core/admin/form_section_component.rb', line 41 def border_top @border_top end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
41 42 43 |
# File 'app/components/panda/core/admin/form_section_component.rb', line 41 def description @description end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
41 42 43 |
# File 'app/components/panda/core/admin/form_section_component.rb', line 41 def icon @icon end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
41 42 43 |
# File 'app/components/panda/core/admin/form_section_component.rb', line 41 def title @title end |
Instance Method Details
#content_classes ⇒ Object
58 59 60 |
# File 'app/components/panda/core/admin/form_section_component.rb', line 58 def content_classes "mt-4 space-y-4" end |
#default_attrs ⇒ Object
43 44 45 46 47 48 |
# File 'app/components/panda/core/admin/form_section_component.rb', line 43 def default_attrs base_classes = "mt-6 pt-4" base_classes += " border-t border-gray-200" if border_top {class: base_classes} end |
#description_classes ⇒ Object
54 55 56 |
# File 'app/components/panda/core/admin/form_section_component.rb', line 54 def description_classes "mt-1 text-xs text-gray-500" end |
#heading_classes ⇒ Object
50 51 52 |
# File 'app/components/panda/core/admin/form_section_component.rb', line 50 def heading_classes "text-sm font-semibold text-gray-700 flex items-center gap-2" end |