Class: PhlexKit::InputOtpSlot
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::InputOtpSlot
- Defined in:
- app/components/phlex_kit/input_otp/input_otp_slot.rb
Overview
One character cell of an InputOtp. See input_otp.rb.
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ InputOtpSlot
constructor
A new instance of InputOtpSlot.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(**attrs) ⇒ InputOtpSlot
Returns a new instance of InputOtpSlot.
4 5 6 |
# File 'app/components/phlex_kit/input_otp/input_otp_slot.rb', line 4 def initialize(**attrs) @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/components/phlex_kit/input_otp/input_otp_slot.rb', line 8 def view_template input(**mix({ type: :text, inputmode: "numeric", autocomplete: "one-time-code", maxlength: "1", class: "pk-input-otp-slot", data: { phlex_kit__input_otp_target: "slot", action: [ "input->phlex-kit--input-otp#onInput", "keydown->phlex-kit--input-otp#onKeydown", "paste->phlex-kit--input-otp#onPaste", "focus->phlex-kit--input-otp#onFocus" ].join(" ") } }, @attrs)) end |