The vf-hero component is to be used as a visual queue and page header. As needed, it can take a kicker, heading, sub-heading, text content, and a 'call to action' link.
By default the vf-hero
makes use of the roundels background image. To keep the raw structure of the HTML and CSS the same this is applied using a CSS custom property. The default variant is equivalent to vf-hero--1200
.
You can bring your own image to use with the vf-hero.
Content name | Usage | .yml key |
---|---|---|
Heading | To be used for the heading of the page. | vf_hero_heading |
Heading HREF | To be used as a 'return to home' link for the micro site. | vf_hero_heading_href |
Subheading | Optional content to be used along with the Heading for a terse explainer. | vf_hero_subheading |
Kicker | Optional content that helps define the context of overall content of the page. | vf_hero_kicker |
Text | Optional content that can help explain the page content in a brief paragraph. | vf_hero_text |
Link Text | The text for the hero 'call to action' link. Only works if there is associated Link HREF. | vf_hero_link_text |
Link HREF | The url that the Link Text would be pointing to and opens in the same browser tab. This only works if there is associated Link Text | vf_hero_link_href |
Content name | .yml key |
CSS classname |
---|---|---|
Kicker | vf_hero_kicker |
vf-hero__kicker |
Heading | vf_hero_heading |
vf-hero__heading |
Heading HREF | vf_hero_heading_href |
vf-hero__heading_link |
Subheading | vf_hero_subheading |
vf-hero__subheading |
Text | vf_hero_text |
vf-hero__text |
Link Text | vf_hero_link_text |
vf-hero__link |
Link HREF | vf_hero_link_href |
n/a |
--vf-hero--bg-image
— this is for the url for the background image. It can either be added, inline if you're writing the HTML, using the .yml
data source of vf_hero_image
, or by other needs (a input or upload in WordPress, for example).
---vf-hero--bg-image-size
— this is to determine the sizing of the background image. As group sites are using the roundel image it needs specific dimensions so that it works. These dimensions are auto 28.5rem
. We use a fallback here as background images in vf-hero
should be full bleed by default so the fall back in the CSS is for cover — var(---vf-hero--bg-image-size, cover)
.
IE 11 will get the background colour and the "roundels" image. Under the approach of progressive enhancement, IE 11 will not paint a different background image if added.
For EMBL sites, the vf-hero
can take an image (provided by Design) which should be uploaded to the files site and applied using the custom property available (--vf-hero--bg-image
).
VF Hamburg | Structural Biology
an example of some ancillary text
The Hentze group combines biochemical and systems–level approaches to investigate the connections between gene expression and cell metabolism, and their roles in human disease.
Learn moreDepending on your environment you'll want to use render
or include
. As a rule of thumb: server-side use include
, precompiled browser use render
. If you're using vf-eleventy you should use include
.
include
You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include
is an abstraction of render
and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_heading_href": "JavaScript:Void(0);",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_text": [
"The Hentze group combines biochemical and <a href=\"JavaScript:Void(0);\">systems–level approaches</a> to investigate the connections between <a href=\"JavaScript:Void(0);\">gene expression</a> and <a href=\"JavaScript:Void(0);\">cell metabolism</a>, and their roles in human disease."
],
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include
is not be available.
{% render '@vf-hero', {
"component-type": "container",
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_heading_href": "JavaScript:Void(0);",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_text": [
"The Hentze group combines biochemical and <a href=\"JavaScript:Void(0);\">systems–level approaches</a> to investigate the connections between <a href=\"JavaScript:Void(0);\">gene expression</a> and <a href=\"JavaScript:Void(0);\">cell metabolism</a>, and their roles in human disease."
],
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
} %}
<section class="vf-hero | vf-u-fullbleed" style=" --vf-hero--bg-image-size: auto 28.5rem">
<div class="vf-hero__content | vf-box | vf-stack vf-stack--400">
<p class="vf-hero__kicker"><a href="JavaScript:Void(0);">VF Hamburg</a> | Structural Biology</p>
<h1 class="vf-hero__heading"><a class="vf-hero__heading_link" href="JavaScript:Void(0);">About the Hentze group!</a></h1>
<p class="vf-hero__subheading">an example of some ancillary text</p>
<p class="vf-hero__text">The Hentze group combines biochemical and <a href="JavaScript:Void(0);">systems–level approaches</a> to investigate the connections between <a href="JavaScript:Void(0);">gene expression</a> and <a href="JavaScript:Void(0);">cell metabolism</a>, and their roles in human disease.</p> <a class="vf-hero__link" href="JavaScript:Void(0);">Learn more<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z" fill="" fill-rule="nonzero"></path>
</svg>
</a>
</div>
</section>
VF Hamburg | Structural Biology
an example of some ancillary text
The Hentze group combines biochemical and systems–level approaches to investigate the connections between gene expression and cell metabolism, and their roles in human disease.
Learn moreDepending on your environment you'll want to use render
or include
. As a rule of thumb: server-side use include
, precompiled browser use render
. If you're using vf-eleventy you should use include
.
include
You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include
is an abstraction of render
and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_text": [
"The Hentze group combines biochemical and <a href=\"JavaScript:Void(0);\">systems–level approaches</a> to investigate the connections between <a href=\"JavaScript:Void(0);\">gene expression</a> and <a href=\"JavaScript:Void(0);\">cell metabolism</a>, and their roles in human disease."
],
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image": "url('https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/vf-hero-intense.png');"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include
is not be available.
{% render '@vf-hero', {
"component-type": "container",
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_text": [
"The Hentze group combines biochemical and <a href=\"JavaScript:Void(0);\">systems–level approaches</a> to investigate the connections between <a href=\"JavaScript:Void(0);\">gene expression</a> and <a href=\"JavaScript:Void(0);\">cell metabolism</a>, and their roles in human disease."
],
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image": "url('https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/vf-hero-intense.png');"
} %}
<section class="vf-hero | vf-u-fullbleed" style="--vf-hero--bg-image: url('https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/vf-hero-intense.png');">
<div class="vf-hero__content | vf-box | vf-stack vf-stack--400">
<p class="vf-hero__kicker"><a href="JavaScript:Void(0);">VF Hamburg</a> | Structural Biology</p>
<h1 class="vf-hero__heading">About the Hentze group!</h1>
<p class="vf-hero__subheading">an example of some ancillary text</p>
<p class="vf-hero__text">The Hentze group combines biochemical and <a href="JavaScript:Void(0);">systems–level approaches</a> to investigate the connections between <a href="JavaScript:Void(0);">gene expression</a> and <a href="JavaScript:Void(0);">cell metabolism</a>, and their roles in human disease.</p> <a class="vf-hero__link" href="JavaScript:Void(0);">Learn more<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z" fill="" fill-rule="nonzero"></path>
</svg>
</a>
</div>
</section>
Explore resources from EMBL-EBI
Depending on your environment you'll want to use render
or include
. As a rule of thumb: server-side use include
, precompiled browser use render
. If you're using vf-eleventy you should use include
.
include
You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include
is an abstraction of render
and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"spacing": 400,
"vf_hero_heading": "A journey through bioinformatics",
"vf_hero_text": [
"Explore resources from EMBL-EBI"
],
"vf_hero_image_size": "auto 28.5rem"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include
is not be available.
{% render '@vf-hero', {
"component-type": "container",
"spacing": 400,
"vf_hero_heading": "A journey through bioinformatics",
"vf_hero_text": [
"Explore resources from EMBL-EBI"
],
"vf_hero_image_size": "auto 28.5rem"
} %}
<section class="vf-hero vf-hero--400 | vf-u-fullbleed" style=" --vf-hero--bg-image-size: auto 28.5rem">
<div class="vf-hero__content | vf-box | vf-stack vf-stack--400">
<h1 class="vf-hero__heading">A journey through bioinformatics</h1>
<p class="vf-hero__text">Explore resources from EMBL-EBI</p>
</div>
</section>
Depending on your environment you'll want to use render
or include
. As a rule of thumb: server-side use include
, precompiled browser use render
. If you're using vf-eleventy you should use include
.
include
You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include
is an abstraction of render
and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"spacing": 800,
"vf_hero_heading": "About the Hentze group!",
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include
is not be available.
{% render '@vf-hero', {
"component-type": "container",
"spacing": 800,
"vf_hero_heading": "About the Hentze group!",
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
} %}
<section class="vf-hero vf-hero--800 | vf-u-fullbleed" style=" --vf-hero--bg-image-size: auto 28.5rem">
<div class="vf-hero__content | vf-box | vf-stack vf-stack--400">
<h1 class="vf-hero__heading">About the Hentze group!</h1>
<a class="vf-hero__link" href="JavaScript:Void(0);">Learn more<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z" fill="" fill-rule="nonzero"></path>
</svg>
</a>
</div>
</section>
Depending on your environment you'll want to use render
or include
. As a rule of thumb: server-side use include
, precompiled browser use render
. If you're using vf-eleventy you should use include
.
include
You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include
is an abstraction of render
and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"spacing": 1200,
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include
is not be available.
{% render '@vf-hero', {
"component-type": "container",
"spacing": 1200,
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
} %}
<section class="vf-hero vf-hero--1200 | vf-u-fullbleed" style=" --vf-hero--bg-image-size: auto 28.5rem">
<div class="vf-hero__content | vf-box | vf-stack vf-stack--400">
<h1 class="vf-hero__heading">About the Hentze group!</h1>
<p class="vf-hero__subheading">an example of some ancillary text</p> <a class="vf-hero__link" href="JavaScript:Void(0);">Learn more<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z" fill="" fill-rule="nonzero"></path>
</svg>
</a>
</div>
</section>
This repository is distributed with npm. After installing npm, you can install vf-hero
with this command.
$ yarn add --dev @visual-framework/vf-hero
The style files included are written in Sass. If you're using a VF-core project, you can import it like this:
@import "@visual-framework/vf-hero/index.scss";
Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter
vf-u-fullwidth
or vf-navigation
. In these cases vf-stack is sufficient.vf-intro-group.png
sample hero image.vf_hero_text
from a yaml file under certain contexts.vf-hero--400
variant.vf-hero__content vf-box
sizing padding calculaton for vf-hero--800
variant.vf-hero__content
wider, but make smaller widths max-content
.vf-hero__heading
vf-hero__heading_link
details.set-
style functions to cleaner versionvf-hero__heading__additional
with vf-hero__kicker
.vf-hero__text
.vf_hero_href
had no context option for use in vf-11ty
.flex
property to the SVG so that it's always visible and doesn't get cut off.hero__text
and hero__heading--additional
.max-content
to fit-content
so the __content
element adapts to smaller viewports.--block
variant as it 'looked weird'.max-content
to the __content
part of the component so short titles don't look silly.vf-hero__heading
with nunjucks/yaml.--inverted
: that inverts the foreground and background colours--flush
: pulls the vf-hero__content
to the bottom of the vf-hero
.--offset
: pulls the vf-hero__content
below the vf-hero
container.--centered
: centres the vf-hero__content
component.--block
: makes the vf-hero__content
bleed all the way ot the left of the page.--striped
: inverts the vf-hero__text
to that of what's set in vf-hero__content
.--800
, --1200
, and --1600
spacing variants.vf-hero-theme--
with vf-hero--
for the primary
, secondary
, and tertiary
variants.vf-hero
.--intense
variant.--intense
standardised to our spacing units--intense
variant so parallax image is full width--inlay
modifier--extreme
variant match designs--medium
variants--very-easy
variant
File system location: components/vf-hero
Find an issue on this page? Propose a change or discuss it.