class Primer::Alpha::AutoComplete::Item

Use ‘AutoCompleteItem` to list results of an auto-completed search.

def call

def call
  render(Primer::BaseComponent.new(**@system_arguments)) { content }
end

def initialize(value:, selected: false, disabled: false, **system_arguments)

Parameters:
  • system_arguments (Hash) -- <%= link_to_system_arguments_docs %>
  • disabled (Boolean) -- Whether the item is disabled.
  • selected (Boolean) -- Whether the item is selected.
  • value (String) -- Value of the item.
def initialize(value:, selected: false, disabled: false, **system_arguments)
  @system_arguments = deny_tag_argument(**system_arguments)
  @system_arguments[:tag] = :li
  @system_arguments[:role] = :option
  @system_arguments[:"data-autocomplete-value"] = value
  @system_arguments[:"aria-selected"] = true if selected
  @system_arguments[:"aria-disabled"] = true if disabled
  @system_arguments[:classes] = class_names(
    "autocomplete-item",
    system_arguments[:classes],
    "disabled" => disabled
  )
end