Class: Primer::HeadingComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/primer/heading_component.rb

Overview

Use the Heading component to wrap a component that will create a heading element

Constant Summary

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

Instance Method Summary collapse

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

Constructor Details

#initialize(**system_arguments) ⇒ HeadingComponent

Returns a new instance of HeadingComponent.

Examples:

Default

<%= render(Primer::HeadingComponent.new) { "H1 Text" } %>
<%= render(Primer::HeadingComponent.new(tag: :h2)) { "H2 Text" } %>
<%= render(Primer::HeadingComponent.new(tag: :h3)) { "H3 Text" } %>

Parameters:

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



14
15
16
17
# File 'app/components/primer/heading_component.rb', line 14

def initialize(**system_arguments)
  @system_arguments = system_arguments
  @system_arguments[:tag] ||= :h1
end

Instance Method Details

#callObject



19
20
21
# File 'app/components/primer/heading_component.rb', line 19

def call
  render(Primer::BaseComponent.new(**@system_arguments)) { content }
end