Method: Primer::Beta::NavList#build_item

Defined in:
app/components/primer/beta/nav_list.rb

#build_item(component_klass: Primer::Beta::NavList::Item, **system_arguments, &block) ⇒ Object

Builds a new item but does not add it to the list. Use this method instead of the ‘#with_item` slot if you need to render an item outside the context of a list, eg. if rendering additional items to append to an existing list, perhaps via a separate HTTP request.

Parameters:

  • component_klass (Class) (defaults to: Primer::Beta::NavList::Item)

    The class to use instead of the default <%= link_to_component(Primer::Beta::NavList::Item) %>

  • system_arguments (Hash)

    These arguments are forwarded to <%= link_to_component(Primer::Beta::NavList::Item) %>, or whatever class is passed as the ‘component_klass` argument.

[View source]

116
117
118
119
120
121
122
123
# File 'app/components/primer/beta/nav_list.rb', line 116

def build_item(component_klass: Primer::Beta::NavList::Item, **system_arguments, &block)
  component_klass.new(
    list: top_level_group,
    selected_item_id: @selected_item_id,
    **system_arguments,
    &block
  )
end