Sass Config and templates

npm version

Mixins, functions and variables to power all vf-core components. If you're using a Visual Framework component it's a near-certainty that you'll need this component.

Note: these utilise vf-design-tokens

Functions

set-color.scss

set-color($color-name)

map-deep-get.scss

map-deep-get($map, $keys)

set-layer.scss

set-layer($layer)

string-replace.scss

str-replace($name, $number)

Slice off the first amount($number) of characters from the $name value passed. Primarily used to replace the start of variables for the utility class generation.

vf-functions.scss

Rollup of all functions.

Mixins

blockquote.scss

Reusable styling for html blockquote elements.

@include blockquote;

button.scss

Reusable styling for button elements

@include vf-button;

divider.scss

Reusable styling for divider elements and styling

@include vf-divider;

figure.scss

Reusable styling for figures with optional caption styling

@include figure($has-caption: true);

helpers.scss

Nothing, yet.

links.scss

Styling for links.

@include inline-link( $vf-link--color: $vf-link--color, $vf-link--hover-color: $vf-link--hover-color, $vf-link--visited-color: $vf-link--visited-color, $vf-include-normalisations: $vf-include-normalisations);

@include button-link( $vf-link--color: $vf-link--color, $vf-link--hover-color: $vf-link--hover-color, $vf-link--visited-color: $vf-link--visited-color);

button-link--ghost( $vf-link--color: $vf-link--color, $vf-link--hover-color: $vf-link--hover-color, $vf-link--visited-color: $vf-link--visited-color);

lists.scss

Styling for list types

@include($classname: optional-classname-to-usm, $type: null, unordered, ordered or inline);

margin.scss

Margin, recommended to use with sizing maps

@include margin--block(bottom, map-get($vf-spacing-map, vf-spacing--lg));

padding.scss

Padding, recommended to use with sizing maps

@include padding--block(bottom, map-get($vf-spacing-map, vf-spacing--lg));

text-color.scss

Currently not used. Intelligently pick if white or black should be used as a contrasting colour

typography.scss

Generate correct font information when included into an element. Recommended to use with typography and sizing maps

@include set-type(text-body--3, $global-font-family, $custom-margin-bottom: vf-spacing--lg)

utility--color.scss

Generate lists of values in design token maps. Intended for use by the vf-utility-classes component

utility--slide.scss

A non-jitter causing way to slide elements up/down on hover.

@include vf-slide-on-hover($shift-distance, $direction:up);

utility--spacing.scss

Generate lists of values in design token maps. Intended for use by the vf-utility-classes component

utility--typography.scss

Generate lists of values in design token maps. Intended for use by the vf-utility-classes component

vf-mixins.scss

Rollup of all mixins.

vf-utility-mixins.scss

Rollup of all utility mixins.

vf-disabled.scss

For disable link elements, actions @include vf-disabled($vf-link--disabled-color);

Variables

vf-global-custom-properties.scss

Native CSS properties, currently limited to document spacing.

vf-global-variables.scss

Global Sass variable defaults for the high-level page look of typography, page width, deprecated component text, if normalisations should be included.

vf-variables.scss

Rollup of global Sass variables.

Install

This repository is distributed with [npm][npm]. After [installing npm][install-npm], you can install vf-sass-config and its dependencies with this command.

$ yarn add --dev @visual-framework/vf-sass-config @visual-framework/vf-design-tokens

You might also find the the vf-sass-starter a useful starting point for setting up a customised Sass build.

Usage

The source files included are written in [Sass][sass] (scss) You can simply point your sass include-path at your node_modules directory and import it like this.

@import 'vf-global-variables';
@import 'vf-variables';
@import 'vf-functions';
@import 'vf-mixins';

Make sure you import Sass requirements along with the modules.


File system location: components/vf-sass-config

Variants


Variant: Default live utility

Nunjucks demo

{% render '@vf-sass-config--default', {
  "component-type": "utility"
} %}
        

Sample output

Sample output as HTML

<!-- no template -->
        

Assets

All components in this design system

This page is part of the components section.