Skip to content

Commit

Permalink
Use <h2> instead of <div> on Subhead-heading docs (#1953)
Browse files Browse the repository at this point in the history
  • Loading branch information
hectahertz committed Feb 24, 2022
1 parent e5c5312 commit 3a91a29
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-coats-relate.md
@@ -0,0 +1,5 @@
---
"@primer/css": patch
---

Use <h2> instead of <div> on Subhead-heading docs
18 changes: 9 additions & 9 deletions docs/content/components/subhead.md
Expand Up @@ -8,29 +8,29 @@ bundle: subhead
---


The basic Subhead consists of a `.Subhead` container, which has a light gray bottom border. Use `.Subhead-heading` for the heading itself. It's an `<h2>` sized heading with normal font-weight.
The basic Subhead consists of a `.Subhead` container, which has a light gray bottom border. Use `.Subhead-heading` for the heading itself. It is styled as an `<h2>` sized heading with normal font-weight.

Use a heading element whenever possible as they can be used as navigation for assistive technologies, and avoid skipping levels.

```html live title="Subhead"
<div class="Subhead">
<div class="Subhead-heading">Plain subhead</div>
<h2 class="Subhead-heading">Plain subhead</h2>
</div>
```

To add a top margin to the Subhead, use `.Subhead--spacious`. This is useful for separating sections on a settings page.

```html live title="Spacious Subhead"
<div class="Subhead Subhead--spacious">
<div class="Subhead-heading">Spacious subhead</div>
<h2 class="Subhead-heading">Spacious subhead</h2>
</div>
```

You can add a one line description to the subhead with `.Subhead-description`.

```html live title="Subhead with description"
<div class="Subhead">
<div class="Subhead-heading">Subhead with description</div>
<h2 class="Subhead-heading">Subhead with description</h2>
<div class="Subhead-description">The subhead is a subdued header style with a light bottom border.</div>
</div>
```
Expand All @@ -39,7 +39,7 @@ For longer descriptions, it is recommended that you use a paragraph below the Su

```html live title="Subhead with longer description"
<div class="Subhead">
<div class="Subhead-heading">Plain subhead</div>
<h2 class="Subhead-heading">Plain subhead</h2>
</div>
<p>
This is a longer description that is sitting below the Subheader. It's much longer than a description that could sit comfortably in the Subhead. It might even have <strong>bold</strong> text. <a href="#">Click to learn more.</a>
Expand All @@ -50,12 +50,12 @@ You can add a button or something to the right of `.Subhead-heading` with the `.

```html live title="Subhead with actions"
<div class="Subhead">
<div class="Subhead-heading">Subhead with button</div>
<h2 class="Subhead-heading">Subhead with button</h2>
<div class="Subhead-actions"><a href="#url" class="btn btn-sm btn-primary" role="button">Action</a></div>
</div>

<div class="Subhead Subhead--spacious">
<div class="Subhead-heading">Subhead with link</div>
<h2 class="Subhead-heading">Subhead with link</h2>
<div class="Subhead-actions"><a href="#url">Learn more</a></div>
</div>
```
Expand All @@ -64,7 +64,7 @@ Use all the elements together to create a Subhead with actions and a description

```html live title="Subhead with actions and description"
<div class="Subhead">
<div class="Subhead-heading">Subhead with actions and description</div>
<h2 class="Subhead-heading">Subhead with actions and description</h2>
<div class="Subhead-actions"><a href="#url" class="btn btn-sm btn-primary" role="button">Action</a></div>
<div class="Subhead-description">The subhead is a subdued header style with a light bottom border.</div>
</div>
Expand All @@ -74,6 +74,6 @@ Use the `.Subhead-heading--danger` modifier to make the text bold and red. This

```html live title="Subhead danger"
<div class="Subhead">
<div class="Subhead-heading Subhead-heading--danger">Danger zone</div>
<h2 class="Subhead-heading Subhead-heading--danger">Danger zone</h2>
</div>
```

0 comments on commit 3a91a29

Please sign in to comment.