Element showing progress of an action. Can be used with helper text to show the user what the progress is.
Takes percentage as a parameter and renders progress as filled bar. If percentage is not provided, it will be set to 0.
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",
"progressPercent": 30,
"width": "14rem"
}
%}
{% include "../path_to/vf-progress-indicator/vf-progress-indicator.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-progress-indicator', {
"component-type": "block",
"progressPercent": 30,
"width": "14rem"
} %}
<div role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" class="vf-progress-indicator" style="--vf-progress-indicator__width: 14rem">
<div class="vf-progress-indicator__mark" style="--vf-progress-indicator__percent: 30%"></div>
</div>
Some helper text
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",
"helperText": "Some helper text",
"progressPercent": 70,
"width": "14rem"
}
%}
{% include "../path_to/vf-progress-indicator/vf-progress-indicator.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-progress-indicator', {
"component-type": "block",
"helperText": "Some helper text",
"progressPercent": 70,
"width": "14rem"
} %}
<div role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" class="vf-progress-indicator" style="--vf-progress-indicator__width: 14rem">
<div class="vf-progress-indicator__mark" style="--vf-progress-indicator__percent: 70%"></div>
<p class="vf-progress-indicator__helper-text">Some helper text</p>
</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-progress-indicator
with this command.
$ yarn add --dev @visual-framework/vf-progress-indicator
NO JS yet.
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-progress-indicator/index.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-progress-indicator
Find an issue on this page? Propose a change or discuss it.