4.0.13 • Published 2 months ago

@nice-digital/nds-page-header v4.0.13

Weekly downloads
46
License
MIT
Repository
github
Last release
2 months ago

@nice-digital/nds-page-header

Page header component for the NICE Design System

Installation

Install Node, and then:

npm i @nice-digital/nds-page-header --save

Usage

React

Import the PageHeader component from the package and use within JSX:

import React from "react";
import { PageHeader } from "@nice-digital/nds-page-header";

// The minimum to be supplied to render the component is a heading string

<PageHeader heading="Welcome to the page" />;

Note: The React component automatically imports the SCSS, so there's no need to import the SCSS directly yourself.

Props

heading
  • Type: React.ReactNode (required)

The main title that is rendered into a H1 with H1 styling.

<PageHeader heading="Welcome to the page" />

useAltHeading

  • Type: boolean (optional)

Whether to use the h1-alt alternative (smaller) heading 1 style.

<PageHeader useAltHeading ... />
preheading
  • Type: React.ReactNode

For occasions when the main title might be too long, a smaller H3 styled span that is rendered just above the main title.

<PageHeader heading="Products" preheading="Systemic lupus erythematosus" />
lead
  • Type: React.ReactNode

Lead text serves as a short introduction to the page, rendered as a paragraph.

<PageHeader
	heading="Products"
	lead="A list of all our products on systemic lupus erythematosus"
/>
metadata
  • Type: Array<React.ReactNode>
<PageHeader
	heading="Cerliponase alfa for treating neuronal ceroid lipofuscinosis type 2"
	metadata={[
		"Highly specialised technologies guidance",
		"HST12",
		"Last updated: 29 October 2019",
		"Last updated: 29 October 2019"
	]}
/>
cta
  • Type: React.ReactNode

Room for a button or other call-to-action.

const CtaButton = <button onclick={()=>false}>
	Find out more about this topic
</button>

<PageHeader heading="Products" cta={CtaButton} />

breadcrumbs

  • Type: React.ReactNode

Add breadcrumbs here, using the NDS breadcrumb component.

<PageHeader
	heading="Header with breadcrumbs"
	breadcrumbs={
		<Breadcrumbs>
			<Breadcrumb to="https://www.nice.org.uk/">Home</Breadcrumb>
			<Breadcrumb to="https://www.nice.org.uk/guidance">
				NICE guidance
			</Breadcrumb>
			<Breadcrumb>Published</Breadcrumb>
		</Breadcrumbs>
	}
/>

description

  • Type: React.ReactNode

Add an optional description, which will be displayed below the lead text.

<PageHeader
	heading="Header with description"
	description="I am a description"
/>

variant

  • Type: "normal" | "fullWidthDark" | "fullWidthLight";

The normal variant is the default and can be omitted.

The two full width variants span the full width of the page, breaking out of any containers. There is a light and a dark version.

<PageHeader
	heading="I am a full width light header!"
	variant="fullWidthLight"
/>
<PageHeader
	heading="I am a full width dark header!"
	variant="fullWidthDark"
/>

### SCSS

If you're not using [React](#react), then import the SCSS directly into your application by:

```scss
@forward '@nice-digital/nds-page-header/scss/page-header';

HTML

If you're not using React, then include the SCSS as above and use the HTML:

<div class="page-header">
	<h1 class="page-header__heading page-header__heading--alt">
		<span class="page-header__pre-heading">
			Systemic lupus erythematosus
		</span>
		Products
	</h1>
	<p class="page-header__lead">
		A list of all our products on systemic lupus erythematosus
	</p>
	<ul class="page-header__metadata" aria-label="Some relevant label for the metadata">
		<li>Highly specialised technologies guidance</li>
		<li>HST12</li>
		<li>Last updated: 29 October 2019</li>
		<li>Last updated: 29 October 201</li>
	</ul>
	<p class="page-header__cta">
		<button>Find out more now</button>
	</p>
</div>
4.0.13

2 months ago

4.0.9-alpha.0

3 months ago

4.0.12

3 months ago

4.0.11

3 months ago

4.0.10

3 months ago

4.0.9

3 months ago

4.0.8

3 months ago

4.0.7

4 months ago

4.0.7-alpha.0

4 months ago

4.0.6

10 months ago

4.0.5

12 months ago

4.0.4

1 year ago

4.0.3

1 year ago

4.0.2

1 year ago

4.0.2-alpha.0

1 year ago

3.0.3

1 year ago

4.0.0-alpha.0

1 year ago

3.0.2-alpha.0

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.1-alpha.0

2 years ago

2.0.4-alpha.0

2 years ago

2.0.6-alpha.0

2 years ago

2.0.0-alpha.0

2 years ago

2.0.2-alpha.0

2 years ago

2.0.9-alpha.0

2 years ago

1.2.21-alpha.0

2 years ago

1.2.19-alpha.0

2 years ago

3.0.0

2 years ago

2.0.7-alpha.0

2 years ago

2.0.11-alpha.0

2 years ago

1.2.18

2 years ago

2.0.3-alpha.0

2 years ago

2.0.5-alpha.0

2 years ago

2.0.10-alpha.0

2 years ago

2.0.1-alpha.0

2 years ago

2.0.8-alpha.0

2 years ago

1.2.20-alpha.0

2 years ago

1.2.17

2 years ago

1.2.16

2 years ago

1.2.15

2 years ago

1.2.14

2 years ago

1.2.12

3 years ago

1.2.13

2 years ago

1.2.11

3 years ago

1.2.11-alpha.0

3 years ago

1.2.8

3 years ago

1.2.10-alpha.0

3 years ago

1.2.9-alpha.0

3 years ago

1.2.8-alpha.0

3 years ago

1.2.7-alpha.0

3 years ago

1.2.6-alpha.0

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.4-alpha.0

3 years ago

1.2.2-alpha.0

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.2.0-alpha.0

3 years ago

1.2.0-alpha.1

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.23-alpha.0

4 years ago

1.0.22-alpha.0

4 years ago

1.0.21-alpha.0

4 years ago

1.0.20-alpha.0

4 years ago

1.0.18-alpha.0

4 years ago

1.0.17-alpha.0

4 years ago

1.0.16-alpha.0

4 years ago

1.0.15-alpha.0

4 years ago

1.0.14-alpha.0

4 years ago

1.0.12-alpha.0

4 years ago

1.0.11-alpha.0

5 years ago

1.0.10-alpha.0

5 years ago

1.0.9-alpha.0

5 years ago

1.0.8-alpha.0

5 years ago

1.0.7-alpha.0

5 years ago

1.0.6-alpha.0

5 years ago

1.0.5-alpha.0

5 years ago

1.0.4-alpha.0

5 years ago

1.0.3-alpha.0

5 years ago

1.0.2-alpha.0

5 years ago