4.0.12 • Published 2 months ago

@nice-digital/nds-hero v4.0.12

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

@nice-digital/nds-hero

Page hero component for the NICE Design System

Installation

Install Node, and then:

npm i @nice-digital/nds-hero --save

Usage

React

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

import React from "react";
import { Hero } from "@nice-digital/nds-hero";

<Hero title="This is the page title">

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

Props

title
  • Type: React.ReactNode (required)

Will be rendered into the h1 tag on in the hero component.

<Hero title="This is the title" />;

const formattedTitle = (
	<>
		This is <i>the title</i>
	</>
);
<Hero title={formattedTitle} />;
header
  • Type: React.ReactNode

Optional space at the top of the component to allow the insertion of Breadcrumb or PhaseBanner components.

<Hero title="The title" header={<PhaseBanner phase="alpha" />}>
intro
  • Type: React.ReactNode

The lead text that will be rendered into a paragraph below the main title.

<Hero title="Page title" intro="Intro text for the page" />
actions
  • Type: React.ReactNode

A space to place important buttons or call to actions.

const myCallsToAction = (
	<>
		<button className="btn btn--cta">Button One</button>
		<button className="btn btn--cta">Button Two</button>
	</>
);
<Hero title="Page title" actions={myCallsToAction} />;
image
  • Type: string

The URL to an image that will be displayed on the right hand side on desktop resolutions.

isDark
  • Type: boolean

If set to true, the hero will have a dark background and text within the hero will be light.

className
  • Type: string

Any additional className will be merged on to the container.

SCSS

If you're not using React, then import the SCSS directly into your application by:

@forward '@nice-digital/nds-hero/scss/hero';

HTML

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

<div class="hero">
	<div class="hero__container">
		<nav aria-label="Breadcrumbs" role="navigation">
			<ol class="breadcrumbs">
				<li class="breadcrumbs__crumb">
					<a href="https://www.nice.org.uk">NICE</a>
				</li>
				<li class="breadcrumbs__crumb">
					<span>CKS</span>
				</li>
			</ol>
		</nav>
		<div class="hero__body">
			<div class="hero__copy">
				<h1 class="hero__title">This is the title</h1>
				<p class="hero__intro">
					This is a hero intro that should explain in a few words what the site
					is about
				</p>
				<div class="hero__actions">
					<button type="button" class="btn btn--cta">Hello!</button>
				</div>
			</div>
			<div class="hero__extra">
				<h2 class="h4">Extras column</h2>
				<ul>
					<li>A list item</li>
					<li>Another list item</li>
					<li><a href="#">A link</a></li>
				</ul>
			</div>
			<div class="hero__footer" aria-labelledby="new-updated">
				<h2 class="h5 mv--0 show--ib mr--d" id="new-updated">
					New&nbsp;and updated products:
				</h2>
				<ul class="list list--piped show--ib">
					<li>
						<a href="/guidance/date"
							><span class="visually-hidden">New and updated products </span
							><span class="text-uppercase">t</span>his month</a>
					</li>
					<li>
						<a href="/guidance/lastmonth"
							><span class="visually-hidden">New and updated products </span
							><span class="text-uppercase">l</span>ast month</a>
					</li>
					<li>
						<a href="/guidance/last6months"
							><span class="visually-hidden"
								>New and updated products in the </span
							><span class="text-uppercase">l</span>ast 6 months</a>
					</li>
				</ul>
			</span>
		</div>
	</div>
</div>
4.0.12

2 months ago

4.0.11

2 months ago

4.0.10

2 months ago

4.0.9

2 months ago

4.0.8

3 months ago

4.0.7

3 months ago

4.0.7-alpha.0

3 months ago

4.0.6

10 months ago

4.0.5

11 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.1-alpha.0

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.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.17

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.18-alpha.0

2 years ago

2.0.12-alpha.0

2 years ago

1.2.20-alpha.0

2 years ago

1.2.16

2 years ago

1.2.15

2 years ago

1.2.14

2 years ago

1.2.12

2 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.1.2

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

4 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