class Primer::Beta::Heading
<%= link_to_heading_practices %>
Headings allow assistive technology users to quickly navigate around a page. Navigation to text that is not meant to be a heading can be a confusing experience.
consistent. [See WCAG success criteria: 1.3.1: Info and Relationships](www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html)
When text on a page is visually implied to be a heading, ensure that it is coded as a heading. Additionally, visually implied heading level and coded heading level should be
While sighted users rely on visual cues such as font size changes to determine what the heading is, assistive technology users rely on programatic cues that can be read out.
@accessibility
- Do not jump heading levels. For instance, do not follow a ‘<h1>` with an `<h3>`. Heading levels should increase by one in ascending order.
such as `font_size` and `font_weight`.
- Do not use `Heading` for styling alone. For simply styling text, consider using <%= link_to_component(Primer::Beta::Text) %> with relevant <%= link_to_typography_docs %>
- Use `Heading` as the title of a section or sub section.
- Set tag to one of `:h1`, `:h2`, `:h3`, `:h4`, `:h5`, `:h6` based on what is appropriate for the page context.
`Heading` should be used to communicate page organization and hierarchy.
def call
def call render(Primer::BaseComponent.new(**@system_arguments)) { content } end
def initialize(tag:, **system_arguments)
-
system_arguments
(Hash
) -- <%= link_to_system_arguments_docs %> -
tag
(String
) -- <%= one_of(Primer::Beta::Heading::TAG_OPTIONS) %>
def initialize(tag:, **system_arguments) @system_arguments = system_arguments @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, TAG_FALLBACK) end