Class: Anchor::CheckBoxComponent

Inherits:
Component
  • Object
show all
Includes:
DescribableInput
Defined in:
app/components/anchor/check_box_component.rb

Constant Summary collapse

INPUT_CLASSES =
%w(
  form-checkbox
  rounded
  border-2
  checked:bg-accent
  flex-shrink-0
  m-[3px]
  !size-4.5
  hover:border-gray-600
  checked:hover:border-accent-hover
  checked:hover:bg-accent-hover
  disabled:border-subdued
  disabled:checked:bg-subdued
  disabled:checked:hover:border-subdued
).freeze
DESCRIPTION_CLASSES =
%w(
  text-secondary
  text-sm
  col-start-2
).freeze

Constants included from ViewHelper

ViewHelper::ANCHOR_HELPERS

Instance Method Summary collapse

Methods included from DescribableInput

#aria_description, #description, #description_id, #description_text, #description_translation_html_scope, #description_translation_scope, #human_attribute_description, #human_attribute_html_description, #i18n_model_key

Methods inherited from Component

generate_id

Methods included from ViewHelper

#anchor_form_with, #anchor_svg, #deep_blank?, #merge_options, #popover_trigger_attributes

Methods included from FetchOrFallbackHelper

#fetch_or_fallback

Constructor Details

#initialize(check_box:, attribute:, form_builder:, **kwargs) ⇒ CheckBoxComponent

Returns a new instance of CheckBoxComponent.



27
28
29
30
31
32
33
# File 'app/components/anchor/check_box_component.rb', line 27

def initialize(check_box:, attribute:, form_builder:, **kwargs)
  @check_box = check_box
  @attribute = attribute
  @form_builder = form_builder

  super(**kwargs)
end