react-autoheader
Automatically sets h1
, h2
levels based on component nesting.
Installation
Via npm:
$ npm install --save react-autoheader
Usage
// Inputimport Header Section from 'react-autoheader'; const Example = <Section> <Header>Top level</Header> <Section> <Header>Middle level</Header> <Section> <Header>Bottom level</Header> </Section> <Header>Middle level</Header> </Section> <Header>Top level</Header> </Section>;;
// OutputTop levelMiddle levelBottom levelMiddle levelTop level
Props
Section
Property | Type | Default | Description |
---|---|---|---|
level |
Number | undefined |
Resets the heading level for child components. |