
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@visual-framework/vf-banner
Advanced tools
Informs visitors about important changes or persistent conditions. Use this component if you need to communicate to visitors in a prominent way. Banners are placed at the top of the page or section they apply to, and below the page or section header.
vf-banner vf-banner--notice
vf-banner vf-banner--phase
vf-banner vf-banner--alert vf-banner--info
This replaces vf-banner--phase
vf-banner vf-banner--alert vf-banner--success
vf-banner vf-banner--alert vf-banner--alert
vf-banner vf-banner--alert vf-banner--warning
note: The vf-banner--alert
variants include the option to dismiss the banner. This is currently a 'bring your own JavaScript' button. To include a close button in the markup you need to make sure you have the variable banner__dismissable
set to true
:
banner__dismissable: true
--modal
variantLike all JS-enabled components in the Visual Framework, if you wish to use the bundled JS, you need to include JS data attributes, here is an overview of what the options are for the vf-banner--modal
variant.
dismissible
: standard messaging typeblocking
: full screenpersistent
: no close buttonblocking
banner state"y"
"myServiceName"
"0.1"
Incrementing this string will invalidate old cookies."<a href='#'>Optional button</a><a target='_blank' href='#'>New tab button</a>">
This HTML string will be converted into VF markup for extra buttons. Optional..innerHTML
of this element will be used as the markup for the message itselfAs of version 2.0.0-alpha.0 vf-banner 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.
Install yarn add @visual-framework/vf-banner
Import in your app.module
import { VfBannerAngularModule } from '@visual-framework/vf-banner/vf-banner.angular';
@NgModule({
imports: [VfBannerAngularModule, YourOtherModules],
...
})
Can be used as
<vf-banner [banner__variant]="'banner__info'" [banner__dismissible]="true" [banner__message]="'Here is some very, <em>very</em> <a class=\'vf-banner__link\' href=\'#\' onclick=\'return false;\'>important information</a>'"></vf-banner>
Possible combinations
Variable | Options | Default | Release | Applicable to banner types |
---|---|---|---|---|
banner__message | 'basic' | |||
banner__type | 'basic' | current | all types | |
'inline' | current | |||
'fixed' | current | |||
'top' | current | |||
banner__variant | 'banner__info' | 'basic' | ||
'banner__warning' | ||||
'banner__danger' | ||||
'banner__success' | ||||
banner__dismissible | true, false | false | 'basic' | |
banner__inline_href | 'inline', 'top' | |||
banner__text | 'fixed' | |||
data_service_id | 'fixed' | |||
data_protection_version | 'fixed' |
CSS to be added to your styles.scss
@import '../node_modules/@visual-framework/vf-sass-config/index.scss';
as per your banner of choice add all or some to your styles.scss
@import '../node_modules/@visual-framework/vf-banner/vf-banner.scss';
@import '../node_modules/@visual-framework/vf-banner/vf-banner--phase.scss';
@import '../node_modules/@visual-framework/vf-banner/vf-banner--alerts.scss';
@import '../node_modules/@visual-framework/vf-banner/vf-banner--fixed.scss';
@import '../node_modules/@visual-framework/vf-banner/vf-banner--gdpr.scss';
for the 'fixed' and 'top' banner type additionally add below to styles.scss
@import "../node_modules/@visual-framework/vf-badge/vf-badge.scss";
@import '../node_modules/@visual-framework/vf-button/vf-button.scss';
@import '../node_modules/@visual-framework/vf-grid/vf-grid.scss';
you should also install vf-sass-starter for the styles
Important note on 'fixed' and 'top' variants for Angular:
For the 'fixed' and 'top' variant to work properly in Angular we need to make sure we follow the below additional steps
Usage:
<vf-banner [banner__variant]="'banner__info'" [banner__dismissible]="true" [banner__message]="'Here is some very, <em>very</em> <a class=\'vf-banner__link\' href=\'#\' onclick=\'return false;\'>important information</a>'"></vf-banner>
As of version 2.0.0-alpha.2 vf-banner has experimental React support which has been tested on react version 18.2.0
Install yarn add @visual-framework/vf-banner
Import in the JS file where you want to include this component
import VfBanner from '@visual-framework/vf-banner/vf-banner.react';
Make sure you have the jsx support enabled with babel. Alternatively, you can also copy the vf-banner.react.js file from below to your react project and import as per the location.
Can be used as
<VfBanner banner__variant="banner__info" banner__dismissible="true" banner__message="Here is some very, <em>very</em> <a class='vf-banner__link' href='#' onclick='return false;'>important information</a>"/>
Possible combinations
Variable | Options | Default | Release | Applicable to banner types |
---|---|---|---|---|
banner__message | 'basic' | |||
banner__type | 'basic' | current | all types | |
'inline' | current | |||
'fixed' | current | |||
'top' | current | |||
banner__variant | 'banner__info' | 'basic' | ||
'banner__warning' | ||||
'banner__danger' | ||||
'banner__success' | ||||
banner__dismissible | true, false | false | 'basic' | |
banner__inline_href | 'inline', 'top' | |||
banner__text | 'fixed' | |||
data_service_id | 'fixed' | |||
data_protection_version | 'fixed' |
CSS to be added to your styles.scss
You should install vf-sass-starter for the styles and then add below code in your main SCSS file
$vf-font-plex-mono-prefix: '~@visual-framework/vf-font-plex-mono/assets';
$vf-font-plex-sans-prefix: '~@visual-framework/vf-font-plex-sans/assets';
@import '~@visual-framework/vf-box/vf-box.scss';
@import '~@visual-framework/vf-stack/vf-stack.scss';
@import '~@visual-framework/vf-u-fullbleed/vf-u-fullbleed.scss';
as per your banner of choice add all or some to your styles.scss
@import '~@visual-framework/vf-banner/vf-banner.scss';
@import '~@visual-framework/vf-banner/vf-banner--phase.scss';
@import '~@visual-framework/vf-banner/vf-banner--alerts.scss';
@import '~@visual-framework/vf-banner/vf-banner--gdpr.scss';
for the 'fixed' and 'top' banner type additionally add below to styles.scss
@import '~@visual-framework/vf-banner/vf-banner--fixed.scss';
@import "~@visual-framework/vf-badge/vf-badge.scss";
@import '~@visual-framework/vf-button/vf-button.scss';
@import '~@visual-framework/vf-grid/vf-grid.scss';
Usage:
<VfBanner banner__variant="banner__info" banner__dismissible="true" banner__message="Here is some very, <em>very</em> <a class='vf-banner__link' href='#' onclick='return false;'>important information</a>"/>
This repository is distributed with npm. After installing npm, you can install primer-buttons
with this command.
$ yarn add --dev @visual-framework/vf-banner
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-banner/index.scss";
Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.