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.31.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.30.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.29.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.29.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.28.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.28.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.27.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.27.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.26.2 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.26.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.26.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.25.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.24.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.23.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.23.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.22.2 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.22.1 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.22.0 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.21.3 app/views/govuk_publishing_components/components/_label.html.erb
govuk_publishing_components-21.21.2 app/views/govuk_publishing_components/components/_label.html.erb