Class: UI::InputOtpSeparatorComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
InputOtpSeparatorBehavior
Defined in:
app/view_components/ui/input_otp_separator_component.rb

Overview

SeparatorComponent - ViewComponent implementation

Visual divider between OTP input groups.

Examples:

<%= render UI::SeparatorComponent.new %>

Instance Method Summary collapse

Methods included from InputOtpSeparatorBehavior

#input_otp_separator_classes, #input_otp_separator_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ InputOtpSeparatorComponent

Returns a new instance of InputOtpSeparatorComponent.

Parameters:

  • classes (String) (defaults to: "")

    Additional CSS classes

  • attributes (Hash)

    Additional HTML attributes



14
15
16
17
# File 'app/view_components/ui/input_otp_separator_component.rb', line 14

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/view_components/ui/input_otp_separator_component.rb', line 19

def call
  attrs = input_otp_separator_html_attributes

   :div, **attrs.merge(@attributes) do
    # Render dot or dash separator
     :svg,
      nil,
      xmlns: "http://www.w3.org/2000/svg",
      width: "15",
      height: "15",
      viewBox: "0 0 15 15",
      fill: "none",
      class: "size-4 opacity-50" do
      tag.rect(x: "4", y: "7", width: "7", height: "1", fill: "currentColor", rx: "0.5")
    end
  end
end