The vf-badge
component is used to denote if a page, section, or link has a production state of alpha
, beta
or other information.
The vf-badge
accepts a single text item of content.
content type | variable | description |
---|---|---|
text | text |
The vf-badge
component can also be a link using <a class="vf-badge" href="">badge title</a>
.
variable | options | default |
---|---|---|
text | ||
badge_href | null | |
theme | 'primary' | |
style | 'outline' | |
override_class | ||
id |
As of version 3.0.0-alpha.0 vf-badge has experimental Angular support. This package was generated with Angular version 15.2.0 and has been tested on application with Angular version 15.2.0.
yarn add @visual-framework/vf-badge
import { VfBadgeAngularModule } from '@visual-framework/vf-badge/vf-badge.angular';
@NgModule({
imports: [VfBadgeAngularModule, YourOtherModules],
...
})
<vf-badge [text]="'alpha'" [theme]="'primary'" [id]="'Badge1'"></vf-badge>
@import '../node_modules/@visual-framework/vf-sass-config/index.scss';
@import "../node_modules/@visual-framework/vf-badge/vf-badge.scss";
you should also install vf-sass-starter for the stylesUsage:
<vf-badge [text]="'alpha'" [theme]="'primary'" [id]="'Badge1'"></vf-badge>
As of version 3.0.0-alpha.1 vf-badge has experimental React support which has been tested on react version 18.2.0
yarn add @visual-framework/vf-badge
import VfBadge from '@visual-framework/vf-badge/vf-badge.react';
Make sure you have the jsx support enabled with babel. Alternatively, you can also copy the vf-badge.react.js file from below to your react project and import as per the location.
<VfBadge text="ALPHA" theme="primary" id="Badge1"/>
@import '~@visual-framework/vf-sass-config/index.scss';
@import '~@visual-framework/vf-badge/vf-badge.css';
you should also install and import vf-sass-starter for the stylesUsage:
<VfBadge text="ALPHA" theme="primary" id="Badge1"/>
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" : "alpha",
"theme" : "primary",
}
%}
{% include "../path_to/vf-badge/vf-badge.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-badge', {
"component-type" : "element",
"text" : "alpha",
"theme" : "primary",
}
%}
<vf-badge [text]="'alpha'" [theme]="'primary'" [id]="'Badge1'"/>
<VfBadge text="ALPHA" theme="primary" id="Badge1"/>
<span class="vf-badge vf-badge--primary">alpha</span>
This repository is distributed with npm. After installing npm and yarn, you can install vf-profile
with this command.
$ yarn add --dev @visual-framework/vf-badge
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-badge/index.scss";
Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter
vf-button
.vf-button
.vf-badge--primary
and vf-badge--outline
with vf-badge--secondary
.vf-badge--tertiary
.set-
style functions to cleaner version
File system location: components/vf-badge
Find an issue on this page? Propose a change or discuss it.