Class: UI::InputOtpGroupComponent

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

Overview

GroupComponent - ViewComponent implementation

Container for grouping OTP input slots together visually.

Examples:

<%= render UI::GroupComponent.new do %>
  <%= render UI::SlotComponent.new(index: 0) %>
  <%= render UI::SlotComponent.new(index: 1) %>
<% end %>

Instance Method Summary collapse

Methods included from InputOtpGroupBehavior

#input_otp_group_classes, #input_otp_group_html_attributes

Constructor Details

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

Returns a new instance of InputOtpGroupComponent.

Parameters:

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

    Additional CSS classes

  • attributes (Hash)

    Additional HTML attributes



17
18
19
20
# File 'app/view_components/ui/input_otp_group_component.rb', line 17

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

Instance Method Details

#callObject



22
23
24
25
26
27
28
# File 'app/view_components/ui/input_otp_group_component.rb', line 22

def call
  attrs = input_otp_group_html_attributes

   :div, **attrs.merge(@attributes) do
    content
  end
end