Class: Primer::Beta::BorderBox::Header

Inherits:
Component
  • Object
show all
Defined in:
app/components/primer/beta/border_box/header.rb

Overview

‘BorderBox::Header` is used inside `BorderBox` to render its header slot.

Constant Summary collapse

TITLE_TAG_FALLBACK =
:h2
TITLE_TAG_OPTIONS =
[:h1, TITLE_TAG_FALLBACK, :h3, :h4, :h5, :h6].freeze

Constants inherited from Component

Component::INVALID_ARIA_LABEL_TAGS

Constants included from Status::Dsl

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

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

Instance Method Summary collapse

Methods inherited from Component

deprecated?, generate_id

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from TestSelectorHelper

#add_test_selector

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?

Methods included from ClassNameHelper

#class_names

Methods included from AttributesHelper

#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes

Constructor Details

#initialize(**system_arguments) ⇒ Header

Returns a new instance of Header.

Parameters:

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



32
33
34
35
36
37
38
39
40
41
# File 'app/components/primer/beta/border_box/header.rb', line 32

def initialize(**system_arguments)
  @system_arguments = system_arguments
  @system_arguments[:id] ||= self.class.generate_id
  @system_arguments[:tag] = :div
  @system_arguments[:classes] = class_names(
    "Box-header",
    system_arguments[:classes]
  )
  @id = @system_arguments[:id]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'app/components/primer/beta/border_box/header.rb', line 10

def id
  @id
end