class Primer::Beta::Subhead
<%= link_to_heading_practices %>
The ‘:heading` slot defaults to rendering a `<div>`. Update the tag to a heading element with the appropriate level to improve page navigation for assistive technologies.
@accessibility
- Use the actions slot to render a related action to the right of the heading. Use <%= link_to_component(Primer::ButtonComponent) %> or <%= link_to_component(Primer::Beta::Link) %>.
- Use a succinct, one-line description for the `:description` slot. For longer descriptions, omit the description slot and render a paragraph below the `Subhead`.
- Optionally set the `:description` slot to render a short description and the `:actions` slot for a related action.
Use `Subhead` as the start of a section. The `:heading` slot will render an `<h2>` font-sized text.
def initialize(spacious: false, hide_border: false, **system_arguments)
-
system_arguments
(Hash
) -- <%= link_to_system_arguments_docs %> -
hide_border
(Boolean
) -- Whether to hide the border under the heading. -
spacious
(Boolean
) -- Whether to add spacing to the Subhead.
def initialize(spacious: false, hide_border: false, **system_arguments) @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :div @system_arguments[:classes] = class_names( @system_arguments[:classes], "Subhead", "Subhead--spacious": spacious, "border-bottom-0": hide_border ) @system_arguments[:mb] ||= hide_border ? 0 : nil end
def render?
def render? heading.present? end