Sass API reference
Settings
Assets
$govuk-assets-path
Path to the assets directory, with trailing slash.
This is the directory where the images and fonts subdirectories live. You will need to make this directory available via your application – see the README for details.
View source code for _assets.scss on GitHub
$govuk-images-path
Path to the images folder, with trailing slash.
View source code for _assets.scss on GitHub
$govuk-fonts-path
Path to the fonts folder, with trailing slash.
View source code for _assets.scss on GitHub
$govuk-image-url-function
Custom image URL function
If the built-in image URL helper does not meet your needs, you can specify the name of a custom handler – either built in or by writing your own function.
If you are writing your own handler, ensure that it returns a string wrapped
with url()
Example: Rails asset handling
$govuk-image-url-function: 'image-url';
Example: Custom asset handling
@function my-url-handler($filename) {
// Some custom URL handling
@return url('example.jpg');
}
$govuk-image-url-function: 'my-url-handler';
View source code for _assets.scss on GitHub
$govuk-font-url-function
Custom font URL function
If the built-in font URL helper does not meet your needs, you can specify the name of a custom handler – either built in or by writing your own function.
If you are writing your own handler, ensure that it returns a string wrapped
with url()
Example: Rails asset handling
$govuk-font-url-function: 'font-url';
Example: Custom asset handling
@function my-url-handler($filename) {
// Some custom URL handling
@return url('example.woff');
}
$govuk-font-url-function: 'my-url-handler';
View source code for _assets.scss on GitHub
Colours
$govuk-brand-colour
Brand colour
View source code for _colours-applied.scss on GitHub
$govuk-text-colour
Text colour
View source code for _colours-applied.scss on GitHub
$govuk-canvas-background-colour
Canvas background colour
Used by the footer component and template to give the illusion of a long footer.
View source code for _colours-applied.scss on GitHub
$govuk-body-background-colour
Body background colour
View source code for _colours-applied.scss on GitHub
$govuk-print-text-colour
Text colour for print media
Use ‘true black’ to avoid printers using colour ink to print body text
View source code for _colours-applied.scss on GitHub
$govuk-secondary-text-colour
Secondary text colour
Used for ‘muted’ text, help text, etc.
View source code for _colours-applied.scss on GitHub
$govuk-focus-colour
Focus colour
Used for outline (and background, where appropriate) when interactive elements (links, form controls) have keyboard focus.
View source code for _colours-applied.scss on GitHub
$govuk-focus-text-colour
Focused text colour
Ensure that the contrast between the text and background colour passes WCAG Level AA contrast requirements.
View source code for _colours-applied.scss on GitHub
$govuk-error-colour
Error colour
Used to highlight error messages and form controls in an error state
View source code for _colours-applied.scss on GitHub
$govuk-border-colour
Border colour
Used for borders, separators, rules, keylines etc.
View source code for _colours-applied.scss on GitHub
$govuk-input-border-colour
Input border colour
Used for form inputs and controls
View source code for _colours-applied.scss on GitHub
$govuk-hover-colour
Input hover colour
Used for hover states on form controls
View source code for _colours-applied.scss on GitHub
$govuk-link-colour
Link colour
View source code for _colours-applied.scss on GitHub
$govuk-link-visited-colour
Visited link colour
View source code for _colours-applied.scss on GitHub
$govuk-link-hover-colour
Link hover colour
View source code for _colours-applied.scss on GitHub
$govuk-link-active-colour
Active link colour
View source code for _colours-applied.scss on GitHub
$govuk-colours-organisations
Organisation colours
View source code for _colours-organisations.scss on GitHub
$govuk-use-legacy-palette
Use ‘legacy’ colour palette
Whether or not to use the colour palette from GOV.UK Elements / Frontend Toolkit, for teams that are migrating to GOV.UK Frontend and may be using components from both places in a single application.
View source code for _colours-palette.scss on GitHub
$govuk-colours
Colour palette
View source code for _colours-palette.scss on GitHub
Compatibility
$govuk-compatibility-govukfrontendtoolkit
Compatibility Mode: alphagov/govuk_frontend_toolkit
Set this to true if you are also including alphagov/govuk_frontend_toolkit in your application.
View source code for _compatibility.scss on GitHub
$govuk-compatibility-govuktemplate
Compatibility Mode: alphagov/govuk_template
Enabling this will:
prevent GOV.UK Frontend from including the New Transport typeface, as it’ll use the version of New Transport included with GOV.UK Template.
alter some of the CSS outputted by GOV.UK Frontend to ‘counter’ specific CSS rules in GOV.UK Template.
Set this to true if you are also including alphagov/govuk_template in your application.
View source code for _compatibility.scss on GitHub
$govuk-compatibility-govukelements
Compatibility Mode: alphagov/govuk_elements
Enabling this will:
- alter some of the CSS outputted by GOV.UK Frontend to ‘counter’ specific CSS rules in GOV.UK Elements.
Set this to true if you are also including alphagov/govuk_elements in your application.
View source code for _compatibility.scss on GitHub
Global styles
$govuk-global-styles
Include ‘global’ styles
Whether to style paragraphs (<p>
) and links (<a>
) without explicitly
having to apply the govuk-body
and govuk-link
classes.
View source code for _global-styles.scss on GitHub
Ie8
$govuk-is-ie8
Whether the stylesheet being built is targeting Internet Explorer 8.
View source code for _ie8.scss on GitHub
$govuk-ie8-breakpoint
The name of the breakpoint to use as the target when rasterizing media queries
View source code for _ie8.scss on GitHub
Measurements
$govuk-page-width
Width of main container
View source code for _measurements.scss on GitHub
$govuk-grid-widths
Map of grid column widths
View source code for _measurements.scss on GitHub
$govuk-gutter
Width of gutter between grid columns
View source code for _measurements.scss on GitHub
$govuk-gutter-half
Width of half the gutter between grid columns
View source code for _measurements.scss on GitHub
$govuk-border-width
Standard border width
View source code for _measurements.scss on GitHub
$govuk-border-width-wide
Wide border width
View source code for _measurements.scss on GitHub
$govuk-border-width-narrow
Narrow border width
View source code for _measurements.scss on GitHub
$govuk-border-width-form-element
Form control border width
View source code for _measurements.scss on GitHub
$govuk-border-width-form-element-error
Form control border width when in error state
View source code for _measurements.scss on GitHub
$govuk-border-width-form-group-error
Form group border width when in error state
View source code for _measurements.scss on GitHub
$govuk-focus-width
Border width of focus outline
View source code for _measurements.scss on GitHub
$govuk-hover-width
Hover width for form controls with a hover state
View source code for _measurements.scss on GitHub
Media queries
$govuk-breakpoints
Breakpoint definitions
View source code for _media-queries.scss on GitHub
$govuk-show-breakpoints
Show active breakpoint in top-right corner.
Only use this during local development.
View source code for _media-queries.scss on GitHub
Typography
$govuk-font-family-gds-transport
List of font families to use if using GDS Transport (the default font ‘stack’ for GOV.UK)
View source code for _typography-font-families.scss on GitHub
$govuk-font-family-nta
List of font families to use if using NTA (old font ‘stack’ for GOV.UK)
Usage
Deprecated: To be removed once support for compatibility mode is dropped
View source code for _typography-font-families.scss on GitHub
$govuk-font-family-nta-tabular
List of font families to use if using the ‘tabular numbers’ subset of NTA (the default font ‘stack’ for GOV.UK)
Because ntatabularnumbers only includes the digits 0-10, all other glyphs will ‘fall-through’ the stack to NTA.
Usage
Deprecated: To be removed once support for compatibility mode is dropped
View source code for _typography-font-families.scss on GitHub
$govuk-use-legacy-font
Use ‘legacy’ fonts
Whether or not to use v1 nta font from GOV.UK Elements / Frontend Toolkit, for teams that are migrating to GOV.UK Frontend and may be using components from both places in a single application.
View source code for _typography-font.scss on GitHub
$govuk-font-family
Font families to use for all typography on screen media
View source code for _typography-font.scss on GitHub
$govuk-font-family-tabular
Font families to use when displaying tabular numbers
View source code for _typography-font.scss on GitHub
$govuk-font-family-print
Font families to use for print media
View source code for _typography-font.scss on GitHub
$govuk-include-default-font-face
Include the default @font-face declarations
If you have set $govuk-font-family to something other than
$govuk-font-family-gds-transport
this option is disabled by default.
View source code for _typography-font.scss on GitHub
$govuk-font-weight-regular
Font weight for regular typography
View source code for _typography-font.scss on GitHub
$govuk-font-weight-bold
Font weight for bold typography
View source code for _typography-font.scss on GitHub
$govuk-typography-use-rem
Whether or not to define font sizes in rem, improving accessibility by allowing users to adjust the base font-size. This is enabled by default, unless any of the compatibility mode settings are enabled.
You should make sure that $govuk-root-font-size is set correctly for your project.
View source code for _typography-responsive.scss on GitHub
$govuk-root-font-size
Root font size
This is used to calculate rem sizes for the typography, and should match the effective font-size of your root (or html) element.
Ideally you should not be setting the font-size on the html or root element in order to allow it to scale with user-preference, in which case this should be set to 16px.
If you are integrating Frontend into an existing project that also uses
alphagov/govuk_template and you wish to enable $govuk-typography-use-rem
then you should set this to 10px to match the 62.5% (10px) base font size
that govuk_template sets on the element.
View source code for _typography-responsive.scss on GitHub
$govuk-typography-scale
Responsive typography font map
This is used to generate responsive typography that adapts according to the breakpoints.
Font size and font weight can be defined for each breakpoint. You can define different behaviour on tablet and desktop. The ‘null’ breakpoint is for mobile.
Line-heights will automatically be converted from pixel measurements into relative values. For example, with a font-size of 16px and a line-height of 24px, the line-height will be converted to 1.5 before output.
You can also specify a separate font size and line height for print media.
View source code for _typography-responsive.scss on GitHub
Tools
General tools
govuk-compatibility
Conditional Compatibility Mixin
Selectively output a block (available to the mixin as @content) if a given $product is also identified as being used in the project.
This can then be used to include styles that are only needed to override styles provided by those other products (e.g. where govuk_template has a very specific link selector that otherwise affects buttons).
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$product |
Name of product that we are ‘defending’ against. | String |
Usage
@include govuk-compatibility($product) {
//..
}
Example:
// Override .my-class if GOV.UK Template is also being used
@include govuk-compatibility(govuk_template) {
.my-class {
color: inherit;
}
}
View source code for _compatibility.scss on GitHub
govuk-exports
Export module
Ensure that the modules of CSS that we define throughout Frontend are only included in the generated CSS once, no matter how many times they are imported across the individual components.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$name |
Name of module - must be unique within the codebase | String |
Usage
@include govuk-exports($name) {
//..
}
View source code for _exports.scss on GitHub
govuk-font-url
Font URL
If a custom font-url handler is defined ($govuk-font-url-function) then it will be called, otherwise a url will be returned with the filename appended to the font path.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$filename |
Font filename | String |
View source code for _font-url.scss on GitHub
govuk-if-ie8
Conditionally include rules only for IE8
Usage
@include govuk-if-ie8 {
//..
}
Example: Usage
.foo {
min-width: 100px;
// Specify width for IE8 only
@include govuk-if-ie8 {
width: 100px;
}
}
View source code for _ie8.scss on GitHub
govuk-not-ie8
Conditionally exclude rules for IE8
Usage
@include govuk-not-ie8 {
//..
}
Example: Usage
.foo {
font-weight: bold;
// Enhance foo only for modern browsers (not IE8)
@include govuk-not-ie8 {
font-family: "Comic Sans MS", "Curlz MT" cursive, sans-serif;
color: #FF69B4;
}
}
View source code for _ie8.scss on GitHub
govuk-image-url
Image URL
If a custom image-url handler is defined ($govuk-image-url-function) then it will be called, otherwise a url will be returned with the filename appended to the image path.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$Filename |
for the image to load | String |
View source code for _image-url.scss on GitHub
govuk-em
Convert pixels to em
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$value |
Length in pixels | Number |
|
$context-font-size |
Font size of element | Number |
View source code for _px-to-em.scss on GitHub
govuk-px-to-rem
Convert pixels to rem
The $govuk-root-font-size (defined in settings/_typography-responsive.scss) must be configured to match the font-size of your root (html) element
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$value |
Length in pixels | Number |
View source code for _px-to-rem.scss on GitHub
Helpers
General helpers
govuk-clearfix
Clear floated content within a container using a pseudo element
Usage
@include govuk-clearfix;
View source code for _clearfix.scss on GitHub
govuk-device-pixel-ratio
Media query for retina images (device-pixel-ratio)
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$ratio |
Device pixel ratio | Number |
2 |
Usage
@include govuk-device-pixel-ratio($ratio: 2) {
//..
}
Example: Providing a @2x image for screens that support it
background-image: govuk-image-url("my-image.png");
@include govuk-device-pixel-ratio {
background-image: govuk-image-url("my-image-2x.png");
}
Example: Using a custom ratio
background-image: govuk-image-url("my-image.png");
@include govuk-device-pixel-ratio {
background-image: govuk-image-url("my-image-2x.png");
}
@include govuk-device-pixel-ratio(3) {
background-image: govuk-image-url("my-image-3x.png");
}
View source code for _device-pixels.scss on GitHub
govuk-focused-text
Focused text
Provides an outline to clearly indicate when the target element is focused. Used for interactive text-based elements.
Usage
@include govuk-focused-text;
View source code for _focused.scss on GitHub
govuk-grid-width
Grid width percentage
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$key |
Name of grid width (e.g. two-thirds) | String |
View source code for _grid.scss on GitHub
govuk-grid-column
Generate grid column styles
Creates a grid column with standard gutter between the columns.
Grid widths are defined in the $govuk-grid-widths
map.
By default the column width changes from 100% to specified width at the
‘tablet’ breakpoint, but other breakpoints can be specified using the $at
parameter.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$width |
name of a grid width from $govuk-grid-widths | String |
full |
$float |
left | right | String |
left |
$at |
mobile | tablet | desktop | any custom breakpoint | String |
tablet |
Usage
@include govuk-grid-column($width: "full", $float: "left", $at: "tablet");
Example: Default
.govuk-grid-column-two-thirds {
@include govuk-grid-column(two-thirds)
}
Example: Customising the breakpoint where width percentage is applied
.govuk-grid-column-one-half-at-desktop {
@include govuk-grid-column(one-half, $at: desktop);
}
Example: Customising the float direction
.govuk-grid-column-one-half-right {
@include govuk-grid-column(two-thirds, $float: right);
View source code for _grid.scss on GitHub
govuk-link-common
Common link mixin
Provides the typography and focus state, regardless of link style.
Usage
@include govuk-link-common;
View source code for _links.scss on GitHub
govuk-link-style-default
Default link style mixin
Provides the default unvisited, visited, hover and active states for links.
If you use this mixin in a component you must also include the govuk-link-common mixin in order to get the focus state.
Usage
@include govuk-link-style-default;
Example:
.govuk-component__link {
@include govuk-link-common;
@include govuk-link-style-default;
}
View source code for _links.scss on GitHub
govuk-link-style-muted
Muted style link mixin
Used for secondary links on a page - the link will appear in muted colours regardless of visited state.
If you use this mixin in a component you must also include the govuk-link-common mixin in order to get the focus state.
Usage
@include govuk-link-style-muted;
Example:
.govuk-component__link {
@include govuk-link-common;
@include govuk-link-style-muted;
}
View source code for _links.scss on GitHub
govuk-link-style-text
Text style link mixin
Overrides the colour of links to match the text colour. Generally used by navigation components, such as breadcrumbs or the back link.
If you use this mixin in a component you must also include the govuk-link-common mixin in order to get the focus state.
Usage
@include govuk-link-style-text;
Example:
.govuk-component__link {
@include govuk-link-common;
@include govuk-link-style-text;
}
View source code for _links.scss on GitHub
govuk-link-style-no-visited-state
No visited state link mixin
Used in cases where it is not helpful to distinguish between visited and non-visited links.
For example, navigation links to pages with dynamic content like admin dashboards. The content on the page is changing all the time, so the fact that you’ve visited it before is not important.
If you use this mixin in a component you must also include the govuk-link-common mixin in order to get the focus state.
Usage
@include govuk-link-style-no-visited-state;
Example:
.govuk-component__link {
@include govuk-link-common;
@include govuk-link-style-no-visited-state;
}
View source code for _links.scss on GitHub
govuk-link-print-friendly
Print friendly link mixin
When printing, append the the destination URL to the link text, as long
as the URL starts with either /
, http://
or https://
.
Usage
@include govuk-link-print-friendly;
View source code for _links.scss on GitHub
govuk-media-query
Media Query
This is a currently a wrapper for sass-mq - abstracted so that we can replace it in the future if we so choose.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$from |
One of $govuk-breakpoints | String or Boolean |
false |
$until |
One of $govuk-breakpoints | String or Boolean |
false |
$and |
Additional media query parameters | String or Boolean |
false |
$media-type |
Media type: screen, print… | String |
all |
Usage
@include govuk-media-query($from: false, $until: false, $and: false, $media-type: "all") {
//..
}
Example:
.element {
@include govuk-media-query($from: mobile) {
color: red;
}
@include govuk-media-query($until: tablet) {
color: blue;
}
@include govuk-media-query(mobile, tablet) {
color: green;
}
@include govuk-media-query($from: tablet, $and: '(orientation: landscape)') {
color: teal;
}
@include govuk-media-query(950px) {
color: hotpink;
}
@include govuk-media-query(tablet, $media-type: screen) {
color: hotpink;
}
}
View source code for _media-queries.scss on GitHub
govuk-shape-arrow
Arrow mixin
Generate Arrows (triangles) by using a mix of transparent (1) and coloured borders. The coloured borders inherit the text colour of the element (2).
Ensure the arrow is rendered correctly if browser colours are overridden by providing a clip path (3). Without this the transparent borders are overridden to become visible which results in a square.
We need both because older browsers do not support clip-path.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$direction |
Direction for arrow: up, right, down, left. | String |
|
$base |
Length of the triangle ‘base’ side | Number |
|
$height |
Height of triangle. Omit for equilateral. | Number |
null |
$display |
CSS display property of the arrow | String |
block |
Usage
@include govuk-shape-arrow($direction, $base, $height: null, $display: "block");
View source code for _shape-arrow.scss on GitHub
govuk-spacing
Single point spacing
Returns measurement corresponding to the spacing point requested.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$spacing-point |
Point on the spacing scale (set in settings/_spacing.sccs ) |
Number |
Example:
.element {
padding: govuk-spacing(5);
top: govuk-spacing(2) !important; // if `!important` is required
}
View source code for _spacing.scss on GitHub
govuk-responsive-margin
Responsive margin
Adds responsive margin by fetching a ‘spacing map’ from the responsive
spacing scale, which defines different spacing values at different
breakpoints. Wrapper for the _govuk-responsive-spacing
mixin.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$responsive-spacing-point |
Point on the responsive spacingscale, corresponds to a map of breakpoints and spacing values | Number |
|
$direction |
Direction to add spacing to (top , right , bottom , left , all ) |
String |
all |
$important |
Whether to mark as !important |
Boolean |
false |
$adjustment |
Offset to adjust spacing by | Number |
false |
Usage
@include govuk-responsive-margin($responsive-spacing-point, $direction: "all", $important: false, $adjustment: false);
Example:
.element {
@include govuk-responsive-margin(6, "left", $adjustment: 1px);
}
View source code for _spacing.scss on GitHub
govuk-responsive-padding
Responsive padding
Adds responsive padding by fetching a ‘spacing map’ from the responsive
spacing scale, which defines different spacing values at different
breakpoints. Wrapper for the _govuk-responsive-spacing
mixin.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$responsive-spacing-point |
Point on the responsive spacing scale, corresponds to a map of breakpoints and spacing values | Number |
|
$direction |
Direction to add spacing to (top , right , bottom , left , all ) |
String |
all |
$important |
Whether to mark as !important |
Boolean |
false |
$adjustment |
Offset to adjust spacing | Number |
false |
Usage
@include govuk-responsive-padding($responsive-spacing-point, $direction: "all", $important: false, $adjustment: false);
Example:
.element {
@include govuk-responsive-padding(6, "left", $adjustment: 1px);
}
View source code for _spacing.scss on GitHub
govuk-typography-common
‘Common typography’ helper
Sets the font family and associated properties, such as font smoothing. Also overrides the font for print.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$font-family |
Font family to use | List |
$govuk-font-family |
Usage
@include govuk-typography-common($font-family: $govuk-font-family);
View source code for _typography.scss on GitHub
govuk-text-colour
Text colour helper
Sets the text colour, including a suitable override for print.
Usage
@include govuk-text-colour;
View source code for _typography.scss on GitHub
govuk-typography-weight-regular
Regular font weight helper
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$important |
Whether to mark declarations as !important . Generally Used to create override classes. |
Boolean |
false |
Usage
@include govuk-typography-weight-regular($important: false);
View source code for _typography.scss on GitHub
govuk-typography-weight-bold
Bold font weight helper
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$important |
Whether to mark declarations as !important . Generally Used to create override classes. |
Boolean |
false |
Usage
@include govuk-typography-weight-bold($important: false);
View source code for _typography.scss on GitHub
govuk-typography-responsive
Responsive typography helper
Takes a ‘font map’ as an argument and uses it to create font-size and line-height declarations for different breakpoints, and for print.
Example font map:
$my-font-map: ( null: ( font-size: 16px, line-height: 20px ), tablet: ( font-size: 19px, line-height: 25px ), print: ( font-size: 14pt, line-height: 1.15 ) );
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$font-map |
Font map | Map |
|
$override-line-height |
Non responsive custom line height. Omit to use the line height from the font map. | Number |
false |
$important |
Whether to mark declarations as !important . |
Boolean |
false |
Usage
@include govuk-typography-responsive($font-map, $override-line-height: false, $important: false);
View source code for _typography.scss on GitHub
govuk-font
Font helper
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$size |
Size of the font as it would appear on desktop - uses the responsive font size map | Number |
|
$weight |
Weight: bold or regular |
String |
regular |
$tabular |
Whether to use tabular numbers or not | Boolean |
false |
$line-height |
Line-height, if overriding the default | Number |
false |
Usage
@include govuk-font($size, $weight: "regular", $tabular: false, $line-height: false);
View source code for _typography.scss on GitHub
govuk-visually-hidden
Hide an element visually, but have it available for screen readers
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$important |
Whether to mark as !important |
Boolean |
true |
Usage
@include govuk-visually-hidden($important: true);
View source code for _visually-hidden.scss on GitHub
govuk-visually-hidden-focusable
Hide an element visually, but have it available for screen readers whilst allowing the element to be focused when navigated to via the keyboard (e.g. for the skip link)
This is slightly less opinionated about borders and padding to make it easier to style the focussed element.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$important |
Whether to mark as !important |
Boolean |
true |
Usage
@include govuk-visually-hidden-focusable($important: true);
View source code for _visually-hidden.scss on GitHub
Colour
govuk-colour
Get colour
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$colour |
Name of colour from the colour palette ($govuk-colours ) |
String |
|
$legacy |
Either the name of colour from the legacy palette or a colour literal, to return instead when in ‘legacy mode’ - matching the palette from GOV.UK Template, Elements or Frontend Toolkit | String |
Example: Using legacy colours from the palette
.foo {
background-colour: govuk-colour("mid-grey", $legacy: "grey-2");
}
Example: Using legacy colour literals
.foo {
background-colour: govuk-colour("green", $legacy: #BADA55);
}
View source code for _colour.scss on GitHub
govuk-organisation-colour
Get the colour for a government organisation
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$organisation |
Organisation name, lowercase, hyphenated | String |
|
$websafe |
By default a ‘websafe’ version of the colour will be returned which meets contrast requirements . If you want to use the non-websafe version you can set this to false but your should ensure that you still meets contrast requirements for accessibility - for example, don’t use the non-websafe version for text. |
Boolean |
true |
View source code for _colour.scss on GitHub
govuk-shade
Make a colour darker by mixing it with black
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$colour |
colour to shade | Colour |
|
$percentage |
percentage of $colour in returned color |
Number |
View source code for _colour.scss on GitHub
govuk-tint
Make a colour lighter by mixing it with white
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$colour |
colour to tint | Colour |
|
$percentage |
percentage of $colour in returned color |
Number |
View source code for _colour.scss on GitHub
Objects
General objects
govuk-width-container
Width container mixin
Used to create page width and custom width container classes.
Parameters
Name | Description | Type | Default value |
---|---|---|---|
$width |
Width in pixels | String |
$govuk-page-width |
Usage
@include govuk-width-container($width: "$govuk-page-width");
Example: Creating a 1200px wide container class
.app-width-container--wide {
@include govuk-width-container(1200px);
}
View source code for _width-container.scss on GitHub
General
General
govuk-main-wrapper
Usage
Deprecated: Replace this mixin with more direct references to the spacing mixins.
@include govuk-main-wrapper;
View source code for _main-wrapper.scss on GitHub
govuk-main-wrapper–l
Use govuk-main-wrapper–l when you page does not have Breadcrumbs, phase banners or back links.
Usage
Deprecated: Replace this mixin with more direct references to the spacing mixins.
@include govuk-main-wrapper--l;