Class: Shadcn::Field::Legend::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Field::Legend::Component
- Defined in:
- app/components/shadcn/field/legend/component.rb
Overview
FieldLegend
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(variant: :legend, **attributes) ⇒ Component
constructor
A new instance of Component.
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
#initialize(variant: :legend, **attributes) ⇒ Component
Returns a new instance of Component.
19 20 21 22 |
# File 'app/components/shadcn/field/legend/component.rb', line 19 def initialize(variant: :legend, **attributes) @variant = variant&.to_sym || :legend super(**attributes) end |
Instance Attribute Details
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
17 18 19 |
# File 'app/components/shadcn/field/legend/component.rb', line 17 def variant @variant end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
24 25 26 |
# File 'app/components/shadcn/field/legend/component.rb', line 24 def element_attributes(**defaults) super(**{ "data-variant" => variant }.merge(defaults)) end |