Class: PhlexKit::RadioButton
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::RadioButton
- Defined in:
- app/components/phlex_kit/radio_button/radio_button.rb
Overview
Single radio input. Ported from ruby_ui's RubyUI::RadioButton. Registers as a phlex-kit--form-field input target, so it live-validates inside a PhlexKit::FormField (Stimulus ignores the wiring otherwise).
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ RadioButton
constructor
A new instance of RadioButton.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(**attrs) ⇒ RadioButton
Returns a new instance of RadioButton.
6 |
# File 'app/components/phlex_kit/radio_button/radio_button.rb', line 6 def initialize(**attrs) = (@attrs = attrs) |
Instance Method Details
#view_template ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'app/components/phlex_kit/radio_button/radio_button.rb', line 8 def view_template input(**mix({ type: "radio", class: "pk-radio", data: { phlex_kit__form_field_target: "input", action: "change->phlex-kit--form-field#onInput invalid->phlex-kit--form-field#onInvalid" } }, @attrs)) end |