Sha256: 0d4a46850a1ca488cff85bab85a2e665fd1a43bd1b43561031d2d3c66e0116cf

Contents?: true

Size: 678 Bytes

Versions: 54

Compression:

Stored size: 678 Bytes

Contents

<%
  hint_text ||= ''
  is_radio_label ||= false
  bold ||= false
  heading_size = false unless ['s', 'm', 'l', 'xl'].include?(heading_size)

  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
%>

<%= tag.label for: html_for, class: css_classes do %>
  <%= text %>
<% end %>

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

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
govuk_publishing_components-21.13.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.12.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.11.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.10.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.9.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.8.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.8.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.7.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.6.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.6.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.5.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.4.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.4.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.3.0 app/views/govuk_publishing_components/components/_label.html.erb