Module: CCS::FrontendHelpers::GovUKFrontend::Button

Included in:
CCS::FrontendHelpers::GovUKFrontend
Defined in:
lib/ccs/frontend_helpers/govuk_frontend/button.rb

Overview

GOV.UK Button

This helper is used for generating the button component from the GDS - Components - Button

Instance Method Summary collapse

Instance Method Details

#govuk_button(text, **options) ⇒ ActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK button component

Parameters:

  • text (String)

    the text that will be shown in the button

  • options (Hash)

    options that will be used in customising the HTML

Options Hash (**options):

  • :classes (String)

    additional CSS classes for the button HTML

  • :is_start_button (Boolean)

    indicates if it is a start button

  • :href (String)

    the URI that will be used in anchor tag

  • :form (ActionView::Helpers::FormBuilder)

    the form builder used to create the submit button

  • :attributes (Hash) — default: {}

    any additional attributes that will added as part of the HTML

Returns:

  • (ActiveSupport::SafeBuffer)


22
23
24
# File 'lib/ccs/frontend_helpers/govuk_frontend/button.rb', line 22

def govuk_button(text, **options)
  Components::GovUK::Button.new(context: self, text: text, **options).render
end