Class: UI::InputGroupButton
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::InputGroupButton
- Includes:
- ButtonBehavior, InputGroupButtonBehavior
- Defined in:
- app/components/ui/input_group_button.rb
Overview
Button - Phlex implementation
A button component specifically styled for use within input groups. Uses both ButtonBehavior and InputGroupButtonBehavior for styling.
Instance Method Summary collapse
-
#initialize(size: "xs", variant: "ghost", type: "button", classes: "", **attributes) ⇒ InputGroupButton
constructor
A new instance of InputGroupButton.
- #view_template(&block) ⇒ Object
Methods included from InputGroupButtonBehavior
#input_group_button_attributes, #input_group_button_classes, #input_group_button_html_attributes
Methods included from ButtonBehavior
#button_classes, #button_html_attributes, #render_button
Constructor Details
#initialize(size: "xs", variant: "ghost", type: "button", classes: "", **attributes) ⇒ InputGroupButton
Returns a new instance of InputGroupButton.
22 23 24 25 26 27 28 |
# File 'app/components/ui/input_group_button.rb', line 22 def initialize(size: "xs", variant: "ghost", type: "button", classes: "", **attributes) @size = size @variant = variant @type = type @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/components/ui/input_group_button.rb', line 30 def view_template(&block) # Merge classes from @attributes[:class] with input_group_button_classes # This is needed when as_child patterns pass classes through attributes merged_classes = TailwindMerge::Merger.new.merge([ , @attributes[:class] ].compact.join(" ")) # Use input_group_button_classes which includes button behavior + input group styling ( type: @type, class: merged_classes, **@attributes.except(:type, :variant, :size, :class) ) do yield if block_given? end end |