0.2.0 • Published 5 years ago

@govuk-frederic/table-of-contents v0.2.0

Weekly downloads
7
License
MIT
Repository
-
Last release
5 years ago

TableOfContents

Import

  import TableOfContents from '@govuk-frederic/table-of-contents';

Usage

Simple

<TOC.Container>
  <TOC.Index>
    {
      ({ contents }) =>
        <ul>
          {
            contents.map(
              ({ id, title }) => <li key={id}><a href={`#${id}`}>{title}</a></li>
            )
          }
        </ul>
    }
  </TOC.Index>
  <TOC.Section id="first" title="First">
    <h2>First</h2>
    <p>
      Section content goes here
    </p>
  </TOC.Section>
  <TOC.Section id="second" title="Second">
    <h2>Second</h2>
    <p>
      Section content goes here
    </p>
  </TOC.Section>
</TOC.Container>
0.2.0

5 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.2

6 years ago