Class: Primer::Alpha::ActionMenu::List
- Defined in:
- app/components/primer/alpha/action_menu/list.rb
Overview
This component is part of <%= link_to_component(Primer::Alpha::ActionMenu) %> and should not be used as a standalone component.
Constant Summary collapse
- DEFAULT_ITEM_TAG =
:button
- ITEM_TAG_OPTIONS =
[:a, :"clipboard-copy", DEFAULT_ITEM_TAG].freeze
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Constants included from Primer::AttributesHelper
Primer::AttributesHelper::PLURAL_ARIA_ATTRIBUTES, Primer::AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize(**system_arguments) ⇒ List
constructor
A new instance of List.
- #with_avatar_item(**system_arguments, &block) ⇒ Object
- #with_divider(**system_arguments, &block) ⇒ Object
- #with_group(**system_arguments, &block) ⇒ Object
- #with_item(**system_arguments, &block) ⇒ Object
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from Primer::AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(**system_arguments) ⇒ List
Returns a new instance of List.
15 16 17 18 19 20 |
# File 'app/components/primer/alpha/action_menu/list.rb', line 15 def initialize(**system_arguments) @items = [] @has_group = false @list = Primer::Alpha::ActionMenu::ListWrapper.new(**system_arguments) end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
12 13 14 |
# File 'app/components/primer/alpha/action_menu/list.rb', line 12 def items @items end |
Instance Method Details
#with_avatar_item(**system_arguments, &block) ⇒ Object
40 41 42 43 44 45 46 |
# File 'app/components/primer/alpha/action_menu/list.rb', line 40 def with_avatar_item(**system_arguments, &block) @items << { type: :avatar_item, kwargs: organize_arguments(**system_arguments), block: block } end |
#with_divider(**system_arguments, &block) ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/components/primer/alpha/action_menu/list.rb', line 48 def with_divider(**system_arguments, &block) @items << { type: :divider, kwargs: system_arguments, block: block } end |
#with_group(**system_arguments, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/components/primer/alpha/action_menu/list.rb', line 22 def with_group(**system_arguments, &block) @has_group = true @items << { type: :group, kwargs: system_arguments, block: block } end |
#with_item(**system_arguments, &block) ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/components/primer/alpha/action_menu/list.rb', line 32 def with_item(**system_arguments, &block) @items << { type: :item, kwargs: organize_arguments(**system_arguments), block: block } end |