# @jfrk/react-heading-levels

> Provides components that calculate the correct HTML heading levels for you

Latest version **1.0.0** (published 2020-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jfrk/react-heading-levels
pnpm add @jfrk/react-heading-levels
yarn add @jfrk/react-heading-levels
bun add @jfrk/react-heading-levels
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-01-02 |
| First published | 2020-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Fredrik Johansson |
| Maintainers | jeanfredrik |
| Keywords | react, headings |

## Links

- npm: https://www.npmjs.com/package/@jfrk/react-heading-levels
- Repository: https://github.com/jfrk/react-heading-levels
- npm.io page: https://npm.io/package/@jfrk/react-heading-levels

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-01-02

## README

# React Heading Levels

Provides components that calculate the correct HTML heading levels for you.

## Getting started

Install with NPM:

```bash
npm install --save @jfrk/react-heading-levels
```

or Yarn:

```bash
yarn add @jfrk/react-heading-levels
```

## How to use

Wrap your app in `<HeadingLevelProvider>` and then use the `<H>` component instead of `<h1>`, `<h2>`, `<h3>` etc. Wrap components in the `<Section>` component to increase the heading level for all contained `<H>` components.

Example:

```js
import React from 'react';
import { HeadingLevelProvider, H, Section } from '@jfrk/react-heading-levels';

export default function App() {
  return (
    <HeadingLevelProvider>
      <main className="App">
        <H>Heading 1</H>
        <Section>
          <H>Heading 2</H>
          <H>Heading 2</H>
          <Section>
            <H>Heading 3</H>
            <H>Heading 3</H>
          </Section>
          <H>Heading 2</H>
        </Section>
      </main>
    </HeadingLevelProvider>
  );
}
```

Resulting DOM structure:

```html
<main>
  <h1>Heading 1</h1>
  <h2>Heading 2</h2>
  <h2>Heading 2</h2>
  <h3>Heading 3</h3>
  <h3>Heading 3</h3>
  <h2>Heading 2</h2>
</main>
```

---
_Source: https://npm.io/package/@jfrk/react-heading-levels · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
