Class: Shadcn::InputOtpComponent::GroupComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/shadcn/input_otp_component.rb

Overview

Group subcomponent

Constant Summary collapse

BASE_CLASSES =
"flex items-center"

Instance Attribute Summary collapse

Attributes inherited from BaseComponent

#class_name, #data, #html_options

Instance Method Summary collapse

Methods inherited from BaseComponent

#content

Methods included from Rails::Helpers::ClassNameHelper

#cn

Constructor Details

#initialize(slots: 3, **options) ⇒ GroupComponent

Returns a new instance of GroupComponent.

Parameters:

  • slots (Integer) (defaults to: 3)

    Number of slots in this group



158
159
160
161
# File 'app/components/shadcn/input_otp_component.rb', line 158

def initialize(slots: 3, **options)
  super(**options)
  @slots = slots
end

Instance Attribute Details

#slotsObject (readonly)

Returns the value of attribute slots.



163
164
165
# File 'app/components/shadcn/input_otp_component.rb', line 163

def slots
  @slots
end

Instance Method Details

#callObject



165
166
167
168
169
# File 'app/components/shadcn/input_otp_component.rb', line 165

def call
  tag.div(class: merge_classes(BASE_CLASSES), **html_options.merge(build_data)) do
    content
  end
end