Class: Shadcn::InputGroup::Addon::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::InputGroup::Addon::Component
- Defined in:
- app/components/shadcn/input_group/addon/component.rb
Overview
InputGroupAddon. The one part of this family that is not just markup:
upstream gives it an onClick that focuses the group's input, unless
the click landed on a button. That is the focusControl action.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#align ⇒ Object
readonly
Returns the value of attribute align.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(align: :"inline-start", **attributes) ⇒ Component
constructor
A new instance of Component.
- #style_variants ⇒ Object
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #tag_name
Constructor Details
#initialize(align: :"inline-start", **attributes) ⇒ Component
Returns a new instance of Component.
46 47 48 49 |
# File 'app/components/shadcn/input_group/addon/component.rb', line 46 def initialize(align: :"inline-start", **attributes) @align = align&.to_sym || :"inline-start" super(**attributes) end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
44 45 46 |
# File 'app/components/shadcn/input_group/addon/component.rb', line 44 def align @align end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
55 56 57 58 59 60 61 |
# File 'app/components/shadcn/input_group/addon/component.rb', line 55 def element_attributes(**defaults) super(**{ role: "group", "data-align" => align, "data-action" => "click->shadcn--input-group#focusControl" }.merge(defaults)) end |
#style_variants ⇒ Object
51 52 53 |
# File 'app/components/shadcn/input_group/addon/component.rb', line 51 def style_variants { align: } end |