Class: Primer::Beta::NavList::Heading
- Defined in:
- app/components/primer/beta/nav_list/heading.rb
Overview
The heading placed above a ‘NavList`’s items.
See <%= link_to_component(Primer::Beta::NavList) %> for usage examples.
Direct Known Subclasses
Constant Summary
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 collapse
-
#heading_level ⇒ Object
readonly
Returns the value of attribute heading_level.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#system_arguments ⇒ Object
readonly
Returns the value of attribute system_arguments.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(title:, id: self.class.generate_id, heading_level: 2, **system_arguments) ⇒ Heading
constructor
A new instance of Heading.
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(title:, id: self.class.generate_id, heading_level: 2, **system_arguments) ⇒ Heading
Returns a new instance of Heading.
16 17 18 19 20 21 |
# File 'app/components/primer/beta/nav_list/heading.rb', line 16 def initialize(title:, id: self.class.generate_id, heading_level: 2, **system_arguments) @title = title @id = id @heading_level = heading_level @system_arguments = system_arguments end |
Instance Attribute Details
#heading_level ⇒ Object (readonly)
Returns the value of attribute heading_level.
10 11 12 |
# File 'app/components/primer/beta/nav_list/heading.rb', line 10 def heading_level @heading_level end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'app/components/primer/beta/nav_list/heading.rb', line 10 def id @id end |
#system_arguments ⇒ Object (readonly)
Returns the value of attribute system_arguments.
10 11 12 |
# File 'app/components/primer/beta/nav_list/heading.rb', line 10 def system_arguments @system_arguments end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'app/components/primer/beta/nav_list/heading.rb', line 10 def title @title end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'app/components/primer/beta/nav_list/heading.rb', line 23 def call render( Primer::BaseComponent.new( tag: :"h#{heading_level}", id: id, classes: "ActionListHeader", **system_arguments ).with_content(title) ) end |