Sha256: 5cea1807459d704f8e79842272ea333ef033ed63ceabe2e0e93ced7f80f43507

Contents?: true

Size: 1006 Bytes

Versions: 2

Compression:

Stored size: 1006 Bytes

Contents

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

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

    <%= tag.div class: classes, data: { module: "accessible-autocomplete" } do %>
      <% if multiple %>
        <span class="govuk-hint app-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 %>
  </div>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
govuk_publishing_components-15.3.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb
govuk_publishing_components-15.2.0 app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb