Sha256: 70c32549817a3e8a8efb9e47434edb481ff689838553c30f66af80fee1ee9906

Contents?: true

Size: 1.12 KB

Versions: 12

Compression:

Stored size: 1.12 KB

Contents

<%
  add_gem_component_stylesheet("label")

  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)

  hint_text ||= ""
  id ||= nil
  is_radio_label ||= false
  bold ||= false
  heading_size = false unless shared_helper.valid_heading_size?(heading_size)
  is_page_heading ||= false
  right_to_left ||= false

  css_classes = %w[gem-c-label govuk-label]
  css_classes << "govuk-label--s" if bold
  css_classes << "govuk-radios__label" if is_radio_label
  css_classes << "govuk-label--#{heading_size}" if heading_size

  hint_text_css_classes = %w[govuk-hint]
  hint_text_css_classes << "govuk-radios__hint" if is_radio_label
%>

<% if is_page_heading %>
  <%= tag.h1 text, class: "govuk-label-wrapper" do %>
    <%= tag.label text, id: id, for: html_for, class: css_classes, dir: right_to_left ? "rtl" : nil %>
  <% end %>
<% else %>
  <%= tag.label text, id: id, for: html_for, class: css_classes, dir: right_to_left ? "rtl" : nil %>
<% end %>

<% if hint_text.present? %>
  <%= tag.div id: hint_id, class: hint_text_css_classes, dir: right_to_left ? "rtl" : nil do %>
    <%= hint_text %>
  <% end %>
<% end %>

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
govuk_publishing_components-35.3.5 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-35.3.4 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-35.3.3 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-35.3.2 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-35.3.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-35.3.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-35.2.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-35.1.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-35.1.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-35.0.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-34.14.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-34.13.0 app/views/govuk_publishing_components/components/_label.html.erb