UNPKG

@blackblock/react-anchor-heading

Version:

A React heading component with id that automatically changes with textContent for anchoring.

22 lines (14 loc) 1.2 kB
# React anchor heading [![Maintainability](https://api.codeclimate.com/v1/badges/20bd546e0d604814eb1e/maintainability)](https://codeclimate.com/github/winston0410/react-anchor-heading/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/20bd546e0d604814eb1e/test_coverage)](https://codeclimate.com/github/winston0410/react-anchor-heading/test_coverage) [![Known Vulnerabilities](https://snyk.io/test/github/winston0410/react-anchor-heading/badge.svg?targetFile=package.json)](https://snyk.io/test/github/winston0410/react-anchor-heading?targetFile=package.json) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/c034e24ee16f4470888fb8cc753b08b0)](https://www.codacy.com/gh/winston0410/react-anchor-heading/dashboard?utm_source=github.com&utm_medium=referral&utm_content=winston0410/react-anchor-heading&utm_campaign=Badge_Grade) A React heading component with id that automatically changes with textContent for anchoring. ```javascript import Heading from '@blackblock/react-anchor-heading' //Input <Heading as={'h2'}>Hello world</Heading> //Output <h2 id="hello-world">Hello world</h2> ``` ## Installation ```shell npm i @blackblock/react-anchor-heading ```