Sha256: e704fd08d04c3faa06bd1767e2c4323a4119d9763dd54953929416f400d9401e

Contents?: true

Size: 860 Bytes

Versions: 158

Compression:

Stored size: 860 Bytes

Contents

<%
  hint_text ||= ''
  is_radio_label ||= false
  bold ||= false
  heading_size = false unless ['s', 'm', 'l', 'xl'].include?(heading_size)
  is_page_heading ||= 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, for: html_for, class: css_classes %>
  <% end %>
<% else %>
  <%= tag.label text, for: html_for, class: css_classes %>
<% end %>

<% if hint_text.present? %>
  <%= tag.span id: hint_id, class: hint_text_css_classes do %>
    <%= hint_text %>
  <% end %>
<% end %>

Version data entries

158 entries across 158 versions & 1 rubygems

Version Path
govuk_publishing_components-25.0.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.21.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.21.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.20.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.19.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.18.5 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.18.4 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.18.3 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.18.2 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.18.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.18.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.17.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.16.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.16.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.15.3 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.15.2 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.15.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.15.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.14.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-24.14.0 app/views/govuk_publishing_components/components/_label.html.erb