5.0.30 • Published 2 years ago

@bbc/psammead-headings v5.0.30

Weekly downloads
1,345
License
Apache-2.0
Repository
github
Last release
2 years ago

psammead-headings - Known Vulnerabilities Dependency Status peerDependencies Status Storybook GitHub license npm version PRs Welcome

Description

The Headings are a set of two components, Headline and SubHeading. They use a h1 and h2 HTML element respectively, with the Headline being designed for a single use on the page, with SubHeading being aimed at repeated use.

Installation

npm install @bbc/psammead-headings

Props

ArgumentTypeRequiredDefaultExample
scriptobjectyeslatin{ canon: { groupA: { fontSize: '28', lineHeight: '32',}, groupB: { fontSize: '32', lineHeight: '36', }, groupD: { fontSize: '44', lineHeight: '48', }, }, trafalgar: { groupA: { fontSize: '20', lineHeight: '24', }, groupB: { fontSize: '24', lineHeight: '28', }, groupD: { fontSize: '32', lineHeight: '36', }, }, }
servicestringyesN/A'news'
darkModeboolnofalsetrue

Usage

import { Headline, SubHeading } from '@bbc/psammead-headings';
import { latin } from '@bbc/gel-foundations/scripts';

const Wrapper = () => (
  <Fragment>
    <Heading script={latin} service="news">
      Some headline
    </Heading>
    <SubHeading script={latin} service="news">
      Some subheadline
    </SubHeading>
  </Fragment>
);

SubHeading components can be used as page anchors when passed an id prop. To take the above usage as an example:

<SubHeading id="some-subheadline" script={latin} service="news">
  Some subheadline
</SubHeading>

This usage will allow for the page anchor: www.bbc.com/news/articles/articleID#some-subheadline

When to use this component

These components can be used at any point on the page, however the Headline is designed to be used once at the top of the page. The SubHeading takes an optional id value and passes it to the h2 which can be used as an anchor when referencing content.

Accessibility notes

The SubHeading component has a tabindex of -1 so that it works correctly with screen readers when navigated to via a skip link.

Contributing

Psammead is completely open source. We are grateful for any contributions, whether they be new components, bug fixes or general improvements. Please see our primary contributing guide which can be found at the root of the Psammead respository.

Code of Conduct

We welcome feedback and help on this work. By participating in this project, you agree to abide by the code of conduct. Please take a moment to read it.

License

Psammead is Apache 2.0 licensed.

5.0.30

2 years ago

5.0.29

2 years ago

5.0.28

2 years ago

5.0.27

3 years ago

5.0.26

3 years ago

5.0.23

3 years ago

5.0.24

3 years ago

5.0.25

3 years ago

5.0.21

3 years ago

5.0.22

3 years ago

5.0.20

3 years ago

5.0.19

3 years ago

5.0.18

3 years ago

5.0.17

3 years ago

5.0.16

3 years ago

5.0.15

3 years ago

5.0.14

3 years ago

5.0.13

3 years ago

5.0.12

3 years ago

5.0.11

3 years ago

5.0.10

3 years ago

5.0.9

3 years ago

5.0.8

3 years ago

5.0.7

3 years ago

5.0.6

3 years ago

5.0.5

3 years ago

5.0.4

3 years ago

5.0.3

3 years ago

5.0.2

4 years ago

5.0.1

4 years ago

5.0.0

4 years ago

4.0.3

4 years ago

4.0.1

4 years ago

4.0.2

4 years ago

4.0.0-alpha.0

4 years ago

3.1.40

4 years ago

3.1.39

4 years ago

3.1.38

4 years ago

3.1.37

4 years ago

3.1.36

4 years ago

3.1.34

4 years ago

3.1.35

4 years ago

3.1.33

4 years ago

3.1.32

4 years ago

3.1.31

4 years ago

3.1.30

4 years ago

3.1.29

4 years ago

3.1.28

4 years ago

3.1.27

4 years ago

3.1.26

4 years ago

3.1.25

4 years ago

3.1.23

4 years ago

3.1.24

4 years ago

3.1.22

4 years ago

3.1.21

4 years ago

3.1.20

4 years ago

3.1.19

4 years ago

3.1.18

5 years ago

3.1.17

5 years ago

3.1.16

5 years ago

3.1.15

5 years ago

3.1.14

5 years ago

3.1.13

5 years ago

3.1.12

5 years ago

3.1.11

5 years ago

3.1.10

5 years ago

3.1.9

5 years ago

3.1.8

5 years ago

3.1.7

5 years ago

3.1.6

5 years ago

3.1.5

5 years ago

3.1.4

5 years ago

3.1.3

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.5

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.1.0

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago