Class: BulmaPhlex::Rails::FormButtonLabel

Inherits:
Base
  • Object
show all
Defined in:
lib/bulma_phlex/rails/components/form_button_label.rb

Overview

# Form Button Label

The FormButtonLabel component handles the block content for buttons within forms, allowing icons to be included on either side of the button text.

Instance Method Summary collapse

Constructor Details

#initialize(value, icon_left: nil, icon_right: nil) ⇒ FormButtonLabel

Returns a new instance of FormButtonLabel.



10
11
12
13
14
# File 'lib/bulma_phlex/rails/components/form_button_label.rb', line 10

def initialize(value, icon_left: nil, icon_right: nil)
  @value = value
  @icon_left = icon_left
  @icon_right = icon_right
end

Instance Method Details

#view_templateObject



16
17
18
19
20
# File 'lib/bulma_phlex/rails/components/form_button_label.rb', line 16

def view_template(&)
  render BulmaPhlex::Icon.new(@icon_left) if @icon_left
  label_text(&)
  render BulmaPhlex::Icon.new(@icon_right) if @icon_right
end