A high-density list of meta-information links often found at the bottom of piece of content and similar to citations.
Use this component for secondary nice-to-have information. Tags are typically a high-density cluster of information that is not easily scannable by users. They are often of more use to search engines and users searching a page for information.
If you have critical user-journey lists of links, you should use a vf-list
instead.
This component should not be confused with vf-badge
which indicates the status of an item.
This component targets WCAG 2.1 AA accessibility.
You can also read about the Visual Framework's approach to accessibility.
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",
"tags" : [object Object],[object Object],[object Object],
}
%}
{% include "../path_to/vf-tags/vf-tags.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-tags', {
"component-type" : "block",
"tags" : [object Object],[object Object],[object Object],}
%}
<div class="vf-tags"><a class="vf-link vf-tag" href="Beast of Bodmin">Beast of Bodmin</a><a class="vf-link vf-tag" href="Morgawr">Morgawr</a><a class="vf-link vf-tag" href="Owlman">Owlman</a></div>
This repository is distributed with [npm][https://www.npmjs.com/]. After [installing npm][https://www.npmjs.com/get-npm] and yarn, you can install vf-tags
with this command.
$ yarn add --dev @visual-framework/vf-tags
This component has no JS.
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-tags/vf-tags.scss";
Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter
File system location: components/vf-tags
Find an issue on this page? Propose a change or discuss it.