Sha256: f57ad073d298520a88bbf7dcacddd92e2da3ed6e6ec9eed6602f19f10b85f8ab

Contents?: true

Size: 872 Bytes

Versions: 63

Compression:

Stored size: 872 Bytes

Contents

<%
  id ||= "autocomplete-#{SecureRandom.hex(4)}"
  label ||= nil
  data_attributes ||= nil
  options ||= []
  selected_option ||= nil
  multiple ||= false

  classes = %w(gem-c-accessible-autocomplete govuk-form-group)
%>
<% if label && options.any? %>
  <%= tag.div class: classes, data: { module: "accessible-autocomplete" } do %>
    <%=
      render "govuk_publishing_components/components/label", {
        html_for: id
      }.merge(label.symbolize_keys)
    %>

    <% if multiple %>
      <span class="govuk-hint gem-c-autocomplete__multiselect-instructions">
        <%= t('components.autocomplete.multiselect') %>
      </span>
    <% end %>

    <%=
      select_tag(
        id,
        options_for_select(options, selected_option),
        multiple: multiple,
        class: "govuk-select",
        data: data_attributes
      )
    %>
  <% end %>
<% end %>

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
govuk_publishing_components-17.21.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.20.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.19.1 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.19.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.18.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.17.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.16.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.15.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.14.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.13.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.12.2 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.12.1 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.12.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.11.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.10.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.9.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.8.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.7.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.6.1 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-17.6.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb