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

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

Overview

GOV.UK Field Inputs Radio

This is used to generate an individual radio item

Direct Known Subclasses

Form, Tag

Defined Under Namespace

Classes: Form, Tag

Constant Summary collapse

DEFAULT_ATTRIBUTES =

The default attributes for the radio

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

The type of the input item

'radios'.freeze

Instance Method Summary collapse

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

#render

Constructor Details

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

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



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

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

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