alpha

This version is in early development and is subject to change and therefore not ready for wide use. There may be other stable versions available.

Tags block

A high-density list of meta-information links often found at the bottom of piece of content and similar to citations.

github location npm version

Usage

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.

Accessibility

This component targets WCAG 2.1 AA accessibility.

You can also read about the Visual Framework's approach to accessibility.

Variants

Nunjucks syntax

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.

Using 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": [
    {
      "label": "Beast of Bodmin",
      "link": "JavaScript:Void(0);"
    },
    {
      "label": "Morgawr",
      "definition": "JavaScript:Void(0);"
    },
    {
      "label": "Owlman",
      "definition": "JavaScript:Void(0);"
    }
  ]
}
 %}
{% include "../path_to/vf-tags/vf-tags.njk" %}
                

Using 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": [
    {
      "label": "Beast of Bodmin",
      "link": "JavaScript:Void(0);"
    },
    {
      "label": "Morgawr",
      "definition": "JavaScript:Void(0);"
    },
    {
      "label": "Owlman",
      "definition": "JavaScript:Void(0);"
    }
  ]
} %}
                
HTML
<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>
              

Examples

Installation info

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

JS

This component has no JS.

Sass/CSS

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

Changelog

Changelog

1.0.0-alpha.1

  • Creates a prototype MVP vf-tags component that can be easily improved in the future.
  • https://github.com/visual-framework/vf-core/issues/875

Assets



File system location: components/vf-tags

Find an issue on this page? Propose a change or discuss it.