Module: CCS::FrontendHelpers::GovUKFrontend::Tabs

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

Overview

GOV.UK Tabs

This helper is used for generating the tabs component from the GDS - Components - Tabs

Instance Method Summary collapse

Instance Method Details

#govuk_tabs(items, title = nil, **options) ⇒ ActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Tabs component

Parameters:

  • items (Array<Hash>)

    array of the tab items. See Tab#initialize and Panel#initialize for details of the items in the array.

  • title (NilClass, String) (defaults to: nil)

    title for the tabs table of contents

  • id_prefix (String)

    prefix id for each tab item if no id is specified on each item

  • options (Hash)

    options that will be used in customising the HTML

Options Hash (**options):

  • :classes (String)

    additional CSS classes for the tabs HTML

  • :attributes (Hash) — default: {}

    any additional attributes that will be added as part of the HTML

Returns:

  • (ActiveSupport::SafeBuffer)


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

def govuk_tabs(items, title = nil, **options)
  Components::GovUK::Tabs.new(context: self, items: items, title: title, **options).render
end