Method: Primer::Alpha::ActionList#build_item
- Defined in:
- app/components/primer/alpha/action_list.rb
permalink #build_item(component_klass: ActionList::Item, **system_arguments) ⇒ 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.
189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'app/components/primer/alpha/action_list.rb', line 189 def build_item(component_klass: ActionList::Item, **system_arguments) if single_select? && system_arguments[:active] && items.count(&:active?).positive? raise ArgumentError, "only a single item may be active when select_variant is set to :single" end # rubocop:enable Style/IfUnlessModifier system_arguments[:classes] = class_names( @item_classes, system_arguments[:classes] ) component_klass.new(list: self, **system_arguments) end |