Classic html list <li> and <dl> types: order, unordered, bulleted, inline and definition.
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": "element",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
}
%}
{% include "../path_to/vf-list/vf-list.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-list', {
"component-type": "element",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
} %}
<ul class="vf-list">
<li class="vf-list__item "> a list item </li>
<li class="vf-list__item "> another list item </li>
<li class="vf-list__item "> and another list item </li>
<li class="vf-list__item "> yet another list item </li>
</ul>
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": "element",
"list_type": "default",
"override_class": "vf-list--tight",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
}
%}
{% include "../path_to/vf-list/vf-list.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-list', {
"component-type": "element",
"list_type": "default",
"override_class": "vf-list--tight",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
} %}
<ul class="vf-list vf-list--default | vf-list--tight">
<li class="vf-list__item "> a list item </li>
<li class="vf-list__item "> another list item </li>
<li class="vf-list__item "> and another list item </li>
<li class="vf-list__item "> yet another list item </li>
</ul>
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": "element",
"list_type": "l",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
}
%}
{% include "../path_to/vf-list/vf-list.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-list', {
"component-type": "element",
"list_type": "l",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
} %}
<ul class="vf-list vf-list--l">
<li class="vf-list__item "> a list item </li>
<li class="vf-list__item "> another list item </li>
<li class="vf-list__item "> and another list item </li>
<li class="vf-list__item "> yet another list item </li>
</ul>
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": "element",
"list_type": "inline",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
}
%}
{% include "../path_to/vf-list/vf-list.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-list', {
"component-type": "element",
"list_type": "inline",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
} %}
<ul class="vf-list vf-list--inline">
<li class="vf-list__item "> a list item </li>
<li class="vf-list__item "> another list item </li>
<li class="vf-list__item "> and another list item </li>
<li class="vf-list__item "> yet another list item </li>
</ul>
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": "element",
"list_type": "ordered",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
}
%}
{% include "../path_to/vf-list/vf-list.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-list', {
"component-type": "element",
"list_type": "ordered",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
} %}
<ul class="vf-list vf-list--ordered">
<li class="vf-list__item "> a list item </li>
<li class="vf-list__item "> another list item </li>
<li class="vf-list__item "> and another list item </li>
<li class="vf-list__item "> yet another list item </li>
</ul>
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": "element",
"list_type": "unordered",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
}
%}
{% include "../path_to/vf-list/vf-list.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-list', {
"component-type": "element",
"list_type": "unordered",
"list": [
"a list item",
"another list item",
"and another list item",
"yet another list item"
]
} %}
<ul class="vf-list vf-list--unordered">
<li class="vf-list__item "> a list item </li>
<li class="vf-list__item "> another list item </li>
<li class="vf-list__item "> and another list item </li>
<li class="vf-list__item "> yet another list item </li>
</ul>
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": "element",
"list_type": "definition",
"list": [
{
"term": "Beast of Bodmin",
"definition": "A large feline inhabiting Bodmin Moor."
},
{
"term": "Morgawr",
"definition": "A sea serpent."
},
{
"term": "Owlman",
"definition": "A giant owl-like creature."
}
]
}
%}
{% include "../path_to/vf-list/vf-list.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-list', {
"component-type": "element",
"list_type": "definition",
"list": [
{
"term": "Beast of Bodmin",
"definition": "A large feline inhabiting Bodmin Moor."
},
{
"term": "Morgawr",
"definition": "A sea serpent."
},
{
"term": "Owlman",
"definition": "A giant owl-like creature."
}
]
} %}
<dl class="vf-list vf-list--definition">
<dt class="vf-list__item vf-list--definition__term"> Beast of Bodmin </dt>
<dd class="vf-list__item vf-list--definition__details"> A large feline inhabiting Bodmin Moor. </dd>
<dt class="vf-list__item vf-list--definition__term"> Morgawr </dt>
<dd class="vf-list__item vf-list--definition__details"> A sea serpent. </dd>
<dt class="vf-list__item vf-list--definition__term"> Owlman </dt>
<dd class="vf-list__item vf-list--definition__details"> A giant owl-like creature. </dd>
</dl>
This component is distributed with npm. After installing npm, you can install the vf-list
with this command.
$ yarn add --dev @visual-framework/vf-list
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-list/index.scss";
Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter
vf-list-l
).vf-list--tight
).
File system location: components/vf-list
Find an issue on this page? Propose a change or discuss it.