Module: UI::RadioButtonBehavior
- Included in:
- RadioButton, RadioButtonComponent
- Defined in:
- app/behaviors/ui/radio_button_behavior.rb
Overview
UI::RadioButtonBehavior
Instance Method Summary collapse
- #radio_button_classes ⇒ Object
- #radio_button_data_attributes ⇒ Object
- #radio_button_html_attributes ⇒ Object
- #radio_button_id ⇒ Object
Instance Method Details
#radio_button_classes ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'app/behaviors/ui/radio_button_behavior.rb', line 37 def classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ , classes_value ].compact.join(" ")) end |
#radio_button_data_attributes ⇒ Object
46 47 48 49 50 |
# File 'app/behaviors/ui/radio_button_behavior.rb', line 46 def { slot: "radio-group-item" } end |
#radio_button_html_attributes ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/behaviors/ui/radio_button_behavior.rb', line 22 def attributes_value = respond_to?(:attributes, true) ? attributes : @attributes { type: "radio", class: , name: @name, id: , value: @value, checked: (@checked ? true : nil), disabled: (@disabled ? true : nil), required: (@required ? true : nil), data: }.merge(attributes_value).compact end |
#radio_button_id ⇒ Object
52 53 54 |
# File 'app/behaviors/ui/radio_button_behavior.rb', line 52 def @id || "radio-#{SecureRandom.hex(4)}" end |