Class: Primer::Beta::NavList::Group
- Inherits:
-
Alpha::ActionList
- Object
- ViewComponent::Base
- Component
- Alpha::ActionList
- Primer::Beta::NavList::Group
- Defined in:
- app/components/primer/beta/nav_list/group.rb
Overview
A logical grouping of navigation links with an optional heading.
See <%= link_to_component(Primer::Beta::NavList) %> for usage examples.
Direct Known Subclasses
Constant Summary
Constants inherited from Alpha::ActionList
Alpha::ActionList::ARIA_SELECTION_VARIANT_OPTIONS, Alpha::ActionList::DEFAULT_ARIA_SELECTION_VARIANT, Alpha::ActionList::DEFAULT_MENU_ITEM_ROLE, Alpha::ActionList::DEFAULT_ROLE, Alpha::ActionList::DEFAULT_SCHEME, Alpha::ActionList::DEFAULT_SELECT_VARIANT, Alpha::ActionList::LIST_BOX_ITEM_ROLE, Alpha::ActionList::MENU_ROLE, Alpha::ActionList::SCHEME_MAPPINGS, Alpha::ActionList::SCHEME_OPTIONS, Alpha::ActionList::SELECT_VARIANT_OPTIONS, Alpha::ActionList::SELECT_VARIANT_ROLE_MAP
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 AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Attribute Summary
Attributes inherited from Alpha::ActionList
#aria_selection_variant, #id, #role, #select_variant
Class Method Summary collapse
Instance Method Summary collapse
- #before_render ⇒ Object
- #build_avatar_item(component_klass: NavList::Item, **system_arguments) ⇒ Object
- #build_item(component_klass: NavList::Item, **system_arguments) ⇒ Object
-
#expand! ⇒ Object
Cause this group to show its list of sub items when rendered.
-
#initialize(selected_item_id: nil, **system_arguments) ⇒ Group
constructor
A new instance of Group.
- #kind ⇒ Object
Methods inherited from Alpha::ActionList
#acts_as_form_input?, #acts_as_listbox?, #acts_as_menu?, #allows_selection?, #custom_element_name, #multi_select?, #required_form_arguments_given?, #single_select?, #will_add_item, #with_avatar_item, #with_divider, #with_item
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 AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(selected_item_id: nil, **system_arguments) ⇒ Group
Returns a new instance of Group.
57 58 59 60 61 62 |
# File 'app/components/primer/beta/nav_list/group.rb', line 57 def initialize(selected_item_id: nil, **system_arguments) @system_arguments = system_arguments @selected_item_id = selected_item_id super(**@system_arguments) end |
Class Method Details
.custom_element_name ⇒ Object
51 52 53 |
# File 'app/components/primer/beta/nav_list/group.rb', line 51 def self.custom_element_name Primer::Beta::NavList.custom_element_name end |
Instance Method Details
#before_render ⇒ Object
99 100 101 102 103 |
# File 'app/components/primer/beta/nav_list/group.rb', line 99 def before_render super raise ArgumentError, "NavList groups are required to have headings" unless heading? end |
#build_avatar_item(component_klass: NavList::Item, **system_arguments) ⇒ Object
87 88 89 90 91 92 93 |
# File 'app/components/primer/beta/nav_list/group.rb', line 87 def build_avatar_item(component_klass: NavList::Item, **system_arguments) super( component_klass: component_klass, selected_item_id: @selected_item_id, **system_arguments ) end |
#build_item(component_klass: NavList::Item, **system_arguments) ⇒ Object
78 79 80 81 82 83 84 |
# File 'app/components/primer/beta/nav_list/group.rb', line 78 def build_item(component_klass: NavList::Item, **system_arguments) super( component_klass: component_klass, selected_item_id: @selected_item_id, **system_arguments ) end |
#expand! ⇒ Object
Cause this group to show its list of sub items when rendered. :nocov:
66 67 68 |
# File 'app/components/primer/beta/nav_list/group.rb', line 66 def @expanded = true end |
#kind ⇒ Object
95 96 97 |
# File 'app/components/primer/beta/nav_list/group.rb', line 95 def kind :group end |