
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
react-h-tag
Advanced tools
Automate heading levels for your React app.
npm install react-h-tag
Or, if you prefer yarn:
yarn add react-h-tag
react-h-tag uses React 16.9.0+ as a peer dependency.
In order to create a heading element, use the H component.
import { H } from 'react-h-tag'
function App() {
return (
<div>
<h1>some fancy big h1</h1>
<H>this will be an h2</H>
</div>
)
}
By default all H components will render as <h2> elements—in order to automatically increase heading levels all you need to do is wrap H in an HLevel.
import { H, HLevel } from 'react-h-tag'
function App() {
return (
<div>
<h1>some fancy big h1</h1>
<H>second best, this is a h2</H>
<HLevel>
<H>just a modest h3</H>
</HLevel>
</div>
)
}
You can nest HLevels to let the heading system increase the heading level even further. However, the heading level maxes out at <h6> since there's no such thing as <h7>, <h8>, etc.
import { H, HLevel } from 'react-h-tag'
function App() {
return (
<div>
<h1>some fancy big h1</h1>
<H>second best, this is a h2</H>
<HLevel>
<H>just a modest h3</H>
<HLevel>
<H>smaller now, it's a h4</H>
<HLevel>
<H>h5</H>
<HLevel>
<H>h6</H>
<HLevel>
<H>still an h6, we maxed it out.</H>
</HLevel>
</HLevel>
</HLevel>
</HLevel>
</HLevel>
</div>
)
}
By default, you shouldn't have to worry much about your heading levels. Just drop H components throughout your app and they'll figure out what they need to be based on whether they're inside an HLevel context or not.
However, occasionally you have two heading levels side by side, like in the following HTML:
<div>
<h2>heading 2</h2>
<h3>heading 3</h3>
</div>
As a convenience for these situations, you can use the increase prop to adjust the level of the current H tag
<div>
<H>heading 2</H>
<H increase={1}>heading 3</H>
</div>
h1 tagsBy design, react-h-tag does not allow you to create h1 tags. Since you should only have a single h1 tag on your page, there isn't much need to dynamically figure out h1 tags. This decisions helps you avoid accidentally shipping multiple h1 tags and shooting yourself in the foot.
FAQs
Automate heading levels for your React app.
We found that react-h-tag demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.