0.7.1 • Published 3 years ago

@slice-and-dice/govuk-react-heading v0.7.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Heading

Import

  import Heading from '@govuk-react/heading';

Usage

Simple

<Heading>Heading text</Heading>

To pick different heading levels it is recommended to use the shortcut versions as that will pick the appropriate tag as well as set the appropriate corresponding font size.

Using shortcuts

import { H1, H2, H3, H4, H5, H6 } from "@slice-and-dice/govuk-react-heading";

<H1>h1</H1>
<H2>h2</H2>
<H3>h3</H3>
<H4>h4</H4>
<H5>h5</H5>
<H6>h6</H6>

Differing sizes

<H6 size={80}>
  H6 with font size 80
</H6>
<Heading as="h2" size="SMALL">
  Heading as h2 with SMALL size
</Heading>
<H3 size="LARGE">H3 with LARGE size</H3>

Props pass through

<Heading onClick={() => { console.log('clicked'); }}>Click me</Heading>

References:

Properties

PropRequiredDefaultTypeDescription
asundefinedstringSemantic heading tag to use (e.g. 'h3')By default element used will be an 'h1'
levelundefinednumberSemantic heading level value between 1 and 6 (deprecated)
size'XLARGE'enum(...Object.keys(HEADING_SIZES) | ...Object.keys(TYPOGRAPHY_SCALE))Visual size level, accepts: XLARGE, LARGE, MEDIUM, SMALL, XL, L, M, S or a numeric size that fits in the GDS font scale list