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": "block",
"section_title": "Projects"
}
%}
{% include "../path_to/vf-section-header/vf-section-header.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-section-header', {
"component-type": "block",
"section_title": "Projects"
} %}
<div class="vf-section-header">
<h2 class="vf-section-header__heading"> Projects</h2>
</div>
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": "block",
"section_title": "Projects",
"id": "section-link",
"href": "JavaScript:Void(0);"
}
%}
{% include "../path_to/vf-section-header/vf-section-header.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-section-header', {
"component-type": "block",
"section_title": "Projects",
"id": "section-link",
"href": "JavaScript:Void(0);"
} %}
<div class="vf-section-header">
<h2 class="vf-section-header__heading vf-section-header__heading--is-link" id="section-link"><a href="JavaScript:Void(0);">Projects</a><svg aria-hidden="true" class="vf-section-header__icon | vf-icon vf-icon-arrow--inline-end" width="1em" height="1em" 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></h2>
</div>
News from EMBL’s six sites
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": "block",
"section_title": "Projects",
"id": "section-sub-heading",
"section__subheading": "News from EMBL’s six sites"
}
%}
{% include "../path_to/vf-section-header/vf-section-header.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-section-header', {
"component-type": "block",
"section_title": "Projects",
"id": "section-sub-heading",
"section__subheading": "News from EMBL’s six sites"
} %}
<div class="vf-section-header">
<h2 class="vf-section-header__heading" id="section-sub-heading"> Projects</h2>
<p class="vf-section-header__subheading">News from EMBL’s six sites</p>
</div>
News from EMBL’s six sites
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": "block",
"section_title": "Projects",
"href": "JavaScript:Void(0);",
"id": "section-sub-heading-link",
"section__subheading": "News from EMBL’s six sites"
}
%}
{% include "../path_to/vf-section-header/vf-section-header.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-section-header', {
"component-type": "block",
"section_title": "Projects",
"href": "JavaScript:Void(0);",
"id": "section-sub-heading-link",
"section__subheading": "News from EMBL’s six sites"
} %}
<div class="vf-section-header">
<h2 class="vf-section-header__heading vf-section-header__heading--is-link" id="section-sub-heading-link"><a href="JavaScript:Void(0);">Projects</a><svg aria-hidden="true" class="vf-section-header__icon | vf-icon vf-icon-arrow--inline-end" width="1em" height="1em" 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></h2>
<p class="vf-section-header__subheading">News from EMBL’s six sites</p>
</div>
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": "block",
"section_title": "Projects",
"href": "JavaScript:Void(0);",
"id": "section-sub-heading-link-text",
"section__subheading": "News from EMBL’s six sites",
"vf_section__content": [
"Hello everyone who are doing?",
"Buy <a href=\"#\">Pizza</a>."
]
}
%}
{% include "../path_to/vf-section-header/vf-section-header.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-section-header', {
"component-type": "block",
"section_title": "Projects",
"href": "JavaScript:Void(0);",
"id": "section-sub-heading-link-text",
"section__subheading": "News from EMBL’s six sites",
"vf_section__content": [
"Hello everyone who are doing?",
"Buy <a href=\"#\">Pizza</a>."
]
} %}
<div class="vf-section-header">
<h2 class="vf-section-header__heading vf-section-header__heading--is-link" id="section-sub-heading-link-text"><a href="JavaScript:Void(0);">Projects</a><svg aria-hidden="true" class="vf-section-header__icon | vf-icon vf-icon-arrow--inline-end" width="1em" height="1em" 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></h2>
<p class="vf-section-header__subheading">News from EMBL’s six sites</p>
<p class="vf-section-header__text">Hello everyone who are doing?</p>
<p class="vf-section-header__text">Buy <a href="#">Pizza</a>.</p>
</div>
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": "block",
"section_title": "Projects",
"href": "JavaScript:Void(0);",
"id": "section-link-text",
"vf_section__content": [
"Hello everyone who are doing?",
"Pizza"
]
}
%}
{% include "../path_to/vf-section-header/vf-section-header.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-section-header', {
"component-type": "block",
"section_title": "Projects",
"href": "JavaScript:Void(0);",
"id": "section-link-text",
"vf_section__content": [
"Hello everyone who are doing?",
"Pizza"
]
} %}
<div class="vf-section-header">
<h2 class="vf-section-header__heading vf-section-header__heading--is-link" id="section-link-text"><a href="JavaScript:Void(0);">Projects</a><svg aria-hidden="true" class="vf-section-header__icon | vf-icon vf-icon-arrow--inline-end" width="1em" height="1em" 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></h2>
<p class="vf-section-header__text">Hello everyone who are doing?</p>
<p class="vf-section-header__text">Pizza</p>
</div>
Hello everyone who are doing?
Pizza
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": "block",
"section_title": "Projects",
"id": "section-text",
"vf_section__content": [
"Hello everyone who are doing?",
"Pizza"
]
}
%}
{% include "../path_to/vf-section-header/vf-section-header.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-section-header', {
"component-type": "block",
"section_title": "Projects",
"id": "section-text",
"vf_section__content": [
"Hello everyone who are doing?",
"Pizza"
]
} %}
<div class="vf-section-header">
<h2 class="vf-section-header__heading" id="section-text"> Projects</h2>
<p class="vf-section-header__text">Hello everyone who are doing?</p>
<p class="vf-section-header__text">Pizza</p>
</div>
This component is distributed with npm. After installing npm, you can install the vf-section-header
with this command.
$ yarn add --dev @visual-framework/vf-section-header
The source files included are written in Sass(scss
). You can point your Sass include-path
at your node_modules
directory and import it like this.
@import "@visual-framework/vf-section-header/index.scss";
Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter
h2
em
s so it scales with the typeface size.vf-card
s}
in the Nunjucks template that was corrupting the html.v2.0.0
of the vf-design-tokens
package or newerid
for anchor support--is-link
variant use CSS grid so the arrow SVG icon is always to the top, right of the text
File system location: components/vf-section-header
Find an issue on this page? Propose a change or discuss it.