Classic html list <li>
and <dl>
types: order, unordered, bulleted, inline and definition.
When presenting a series of text-only content such as words or names, consider using a list. The best list type to use will depend on the relationships between the terms.
Default variant:
Tight variant:
Large variant:
Inline variant:
Ordered variant:
Unordered variant:
Definition List
Sort list items in a logical order that makes information easily scannable by the users such as: alphabetical, numerical, chronological, or by user preference.
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,}
%}
<ol 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>
</ol>
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" : [object Object],[object Object],[object Object],
}
%}
{% 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" : [object Object],[object Object],[object Object],}
%}
<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.