The vf-text
component leverages the design token typography sizes.
This component provides a utility-like functionality and you'll rarely need to directly use this component. When coding a component's Sass, it will typically be better to use the mixins (@include set-type(text-body--6);
) than these vf-text
classes.
This text is extra large
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",
"text" : "This text is extra large",
"type" : 1,
}
%}
{% include "../path_to/vf-text/vf-text.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-text', {
"component-type" : "element",
"text" : "This text is extra large",
"type" : 1,}
%}
<p class="vf-text-body vf-text-body--1">This text is extra large</p>
This text is large
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",
"text" : "This text is large",
"type" : 2,
}
%}
{% include "../path_to/vf-text/vf-text.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-text', {
"component-type" : "element",
"text" : "This text is large",
"type" : 2,}
%}
<p class="vf-text-body vf-text-body--2">This text is large</p>
This text is regular
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",
"text" : "This text is regular",
"type" : 3,
}
%}
{% include "../path_to/vf-text/vf-text.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-text', {
"component-type" : "element",
"text" : "This text is regular",
"type" : 3,}
%}
<p class="vf-text-body vf-text-body--3">This text is regular</p>
This text is small
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",
"text" : "This text is small",
"type" : 4,
}
%}
{% include "../path_to/vf-text/vf-text.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-text', {
"component-type" : "element",
"text" : "This text is small",
"type" : 4,}
%}
<p class="vf-text-body vf-text-body--4">This text is small</p>
This text is extra small
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",
"text" : "This text is extra small",
"type" : 5,
}
%}
{% include "../path_to/vf-text/vf-text.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-text', {
"component-type" : "element",
"text" : "This text is extra small",
"type" : 5,}
%}
<p class="vf-text-body vf-text-body--5">This text is extra small</p>
This component is distributed with npm. After installing npm, you can install the vf-text
with this command.
$ yarn add --dev @visual-framework/vf-text
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-text/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-text
Find an issue on this page? Propose a change or discuss it.