Class: CCS::Components::GovUK::Field::Inputs::Item::Checkbox

Inherits:
CCS::Components::GovUK::Field::Inputs::Item show all
Defined in:
lib/ccs/components/govuk/field/inputs/item/checkbox.rb,
lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb,
lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb

Overview

GOV.UK Field Inputs Checkbox

This is used to generate an individual checkbox item

Direct Known Subclasses

Form, Tag

Defined Under Namespace

Classes: Form, Tag

Constant Summary collapse

DEFAULT_ATTRIBUTES =

The default attributes for the checkbox

{ class: 'govuk-checkboxes__input' }.freeze
ITEM_TYPE =

The type of the input item

'checkboxes'.freeze

Instance Method Summary collapse

Methods inherited from CCS::Components::GovUK::Field::Inputs::Item

#render

Constructor Details

#initialize(attribute:, label:, **options) ⇒ Checkbox

label [Hash] attributes for the checkbox label, see Label#initialize for more details.



19
20
21
22
23
# File 'lib/ccs/components/govuk/field/inputs/item/checkbox.rb', line 19

def initialize(attribute:, label:, **options)
  super(attribute: attribute, item_class: 'govuk-checkboxes__item', **options)

  label[:classes] = "govuk-checkboxes__label #{label[:classes]}".rstrip
end