This document outlines the steps needed to migrate to version 72.0.0 of our Design System library from versions 70.x.x. This release includes several breaking-changes that may impact your projects. Please follow this guide to ensure a smooth transition.
Version 71.0.0 wasn't used due to having previously published a version 71.0.0 to npm.
This section will list the changes that will impact more than one component
-
Description of change: New margin and padding sizes and have been introduced and relevant utility classes have been updated with the new corresponding size
-
Reason for change: As we have changed the size of our
rems
to be16px
we needed to introduce new sizes to support our updated spacing grid. -
Components impacted:
- Any component or layout where you have manually set our margin or padding utility classes.
-
Migration steps:
- Locate all instances of the utility classes in your codebase.
- Replace old size name with new corresponding size name:
-
Click for example:
//OLD Sizes $sizes: ( no: 0, xxs: 0.25rem, xs: 0.5rem, s: 1rem, m: 1.5rem, l: 2rem, xl: 3rem, auto: auto, ); //NEW Sizes $sizes: ( no: 0, 4xs: 0.125rem, 3xs: 0.25rem, 2xs: 0.5rem, xs: 0.75rem, s: 1rem, m: 1.25rem, l: 1.5rem, xl: 2rem, 2xl: 2.5rem, 3xl: 3rem, 4xl: 4rem, 5xl: 5rem, auto: auto, );
-
Description of change: Icon sizes have been updated to reflect the new size naming convention. This change replaces the old naming convention (e.g., xxxl, xxl) with a numerical system (e.g., 3xl, 2xl), the same as the one that has been brought for padding and margins.
-
Reason for change: This update standardises how sizes are referenced across the system.
-
Components impacted:
Anywhere an icon size parameter is set to xxxl or xxl.
-
Migration steps:
- Locate all instances of the
iconSize
parameter in your codebase. - Replace old size name with new corresponding size name:
-
Click for example:
//OLD Sizes $sizes: [ "iconSize": 'xxxl', "iconSize": 'xxl' "iconSize": 'xl' "iconSize": 'l' "iconSize": 'm' "iconSize": 's' ]; //NEW Sizes $sizes: [ "iconSize": '3xl', "iconSize": '2xl' "iconSize": 'xl' "iconSize": 'l' "iconSize": 'm' "iconSize": 's' ];
- Locate all instances of the
-
Description of change: Font size classes have been updated to reflect the new size naming convention. This change replaces the old naming convention (e.g., xxxl, xxl) with a numerical system (e.g., 3xl, 2xl), the same as the one that has been brought for padding and margins.
-
Reason for change: This update standardises how sizes are referenced across the system.
-
Components impacted:
Anywhere you use the xxl or xxxl font-size utility classes.
-
Migration steps:
- Locate all instances of the font size utility classes in your codebase.
- Replace old size name with new corresponding size name:
-
Click for example:
//OLD Sizes $sizes: [ 'ons-u-fs-xxxl', 'ons-u-fs-xxl', 'ons-u-fs-xl', 'ons-u-fs-l', 'ons-u-fs-m', 'ons-u-fs-r--b', 'ons-u-fs-r', 'ons-u-fs-s--b', 'ons-u-fs-s' ]; //NEW Sizes $sizes: [ 'ons-u-fs-3xl', 'ons-u-fs-2xl', 'ons-u-fs-xl', 'ons-u-fs-l', 'ons-u-fs-m', 'ons-u-fs-r--b', 'ons-u-fs-r', 'ons-u-fs-s--b', 'ons-u-fs-s' ];
-
Description of change: Breakpoint size names have been updated to reflect the new size naming convention. This change replaces the old naming convention (e.g., xxxl, xxl) with a numerical system (e.g., 3xl, 2xl), the same as the one that has been brought for padding and margins.
-
Reason for change: The new naming convention standardizes how breakpoints are referenced across the design system.
-
Components impacted:
Any component or layout that references breakpoints using the previous naming convention will need to be updated.
-
Migration steps:
- Locate all instances of breakpoints in your codebase.
- Replace old breakpoint names with the new corresponding names:
-
Click for example:
// OLD Breakpoints $breakpoints: [ xxs: 300px, xs: 400px, s: 500px, m: 740px, l: 980px, xl: 1300px, xxl: 1600px, ]; // NEW Breakpoints $breakpoints: [ 2xs: 300px, xs: 400px, s: 500px, m: 740px, l: 980px, xl: 1300px, 2xl: 1600px, ];
-
Description of change:
titleTag
which usually expects a string likeh3
is being replace by aheadingLevel
which now expects an integer. -
Reason for change: In this update, we are addressing an inconsistency in the components/patterns within our system. Some components use
titleTag
while others useheadingLevel
to set the HTML tag for titles/headings. This update aims to standardise the usage by migrating all components usingtitleTag
to usingheadingLevel
.It's important to note that while a default value is set for the heading level, this could be a breaking change as it may alter the heading level in existing use cases and that the new
headingLevel
param will need an integer from now on and not the whole tag. -
Components impacted:
- accordion
- details
- document-list
- panel
- share-page
- tabs
- timeline
-
Migration steps:
- Locate all instances of
titleTag
in your codebase. - Replace
titleTag
withheadingLevel
and replace the heading tag you had with the relevant integer like below
-
Click for example:
OLD {{ onsTimeline({ "titleTag": "h3" }) }} NEW {{ onsTimeline({ "headingLevel" : 3 }) }}
- Locate all instances of
-
Description of change: Many parameter names have been updated.
-
Reason for change: Updated various parameters to use the camel case naming standard.
This will be a breaking change and will require the renaming of some parameters for the following components and parameters:
-
Components impacted:
- Card -
image.placeholderURL
will need to be renamedimage.placeholderUrl
- Cookies Banner -
settingsLinkTextURL
will need to be renamedsettingsLinkTextUrl
- Header -
logo.logoURL
will need to be renamedlogo.logoUrl
- Header -
ISOCode
will need to be renamedisoCode
- Header -
navigation.subNavigation.overviewURL
will need to be renamednavigation.subNavigation.overviewUrl
- Share Page -
pageURL
will need to be renamedpageUrl
- Video -
videoLinkURL
will need to be renamedvideoLinkUrl
- Page Template -
assetsURL
will need to be renamedassetsUrl
- Footer -
OGLLink
will need to be renamedoglLink
- Footer -
oglLink.HTML
will need to be renamedoglLink.html
- Message -
messageID
will need to be renamedmessageId
- Access Code -
maxlength
will need to be renamedmaxLength
- Address input -
APIDomain
will need to be renamedapiDomain
- Address input -
APIDomainBearerToken
will need to be renamedapiDomainBearerToken
- Address input -
APIManualQueryParams
will need to be renamedapiManualQueryParams
- Address input -
errorMessageAPI
will need to be renamederrorMessageApi
- Address input -
errorMessageAPILinkText
will need to be renamederrorMessageApiLinkText
- Card -
-
Migration steps:
- Locate all instances of the above parameters in your codebase.
- Replace
oldParameter
withnewParameter
.
-
Click for example:
OLD {{ onsHeader({ "title": 'Page title', "mastheadLogoUrl": { "multipleLogos": { "logo1": { "logoURL" : "https..." } } }, "titleUrl": '#0', "language": { "languages": [ { "url": '#0', "ISOCode": 'en', "text": 'English', "current": true }, { "url": '#0', "ISOCode": 'cy', "text": 'Cymraeg', "current": false } ] }, "navigation": { "subNavigation": { "overviewURL": "https..." } } }) }} NEW {{ onsHeader({ "title": 'Page title', "mastheadLogoUrl": { "multipleLogos": { "logo1": { "logoUrl" : "https..." } } }, "titleUrl": '#0', "language": { "languages": [ { "url": '#0', "isoCode": 'en', "text": 'English', "current": true }, { "url": '#0', "isoCode": 'cy', "text": 'Cymraeg', "current": false } ] }, "navigation": { "subNavigation": { "overviewUrl": "https..." } } }) }}
-
Description of change: The following classes have been renamed:
ons-grid--flex
toons-grid-flex
ons-grid--center
toons-grid-flex--center
ons-grid--between
toons-grid-flex--between
ons-grid--vertical-top
toons-grid-flex--vertical-top
ons-grid--vertical-center
toons-grid-flex--vertical-center
-
Reason for change: The
ons-grid--flex
utility class has been updated to follow the correct BEM model.This will be a breaking change and will require the update of the old classes name with the new one:
-
Components impacted:
Any component that used the old class name.
-
Migration steps:
- Locate all instances of the above classes in your codebase.
- Replace the old class name with the new one.
-
Click for example:
OLD <div class="ons-header__grid-top ons-grid ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap ons-grid--gutterless" ></div> NEW <div class="ons-header__grid-top ons-grid ons-grid-flex ons-grid-flex--between ons-grid-flex--vertical-center ons-grid-flex--no-wrap ons-grid--gutterless" ></div>
This section will list all the changes that are specific to one component.
- Metadata
- Call to action
- Message
- Footer
- Image
- Header
- Feedback
- Summary
- Timeline
- Document List
- Cookies Banner
- Card
- External links
- Section navigation
- Video
- Address input
Removed metadata component
-
Description of change: The
onsMetadata
component has been removed. -
Reason for change: The component was removed as it has been replaced by the
descriptionList
component. -
Migration steps:
- Locate all instances of
onsMetadata
in your codebase. - You could update any instance of
onsMetadata
withonsDescriptionList
.
-
Click for example:
OLD {% from "components/onsMetadata/_macro.njk" import onsMetadata %} {{ onsMetadata({ ... }) }} NEW {% from "components/description-list/_macro.njk" import onsDescriptionList %} {{ onsDescriptionList({ ... }) }}
- Locate all instances of
Remove call to action component and all references
-
Description of change: The
onsCallToAction
component has been removed. -
Reason for change: The component was removed as it was only developed for use on the Census website.
-
Migration steps:
- Locate all instances of
onsCallToAction
in your codebase. - You could update any instance of
onsCallToAction
withonsButton
. TheonsButton
component is not a replacement for theonsCallToAction
component so transition will not be like for like.
-
Click for example:
OLD {% from "components/call-to-action/_macro.njk" import onsCallToAction %} {{- onsCallToAction({ "headingText": 'Call to action heading.', "paragraphText": 'Descriptive text about call to action', "button": { "text": 'Start', "url": '#0' } }) }} SUGGESTED REPLACEMENT {% from "components/button/_macro.njk" import onsButton %} {{ onsButton({ "text": 'Get started', "url": '#0' }) }}
- Locate all instances of
Update parameter from UnreadLink to UnreadLinkUrl in Message component
-
Description of change: The
unreadLink
parameter has been renamed tounreadLinkUrl
in the Message component. -
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
unreadLink
in your codebase. - Replace
unreadLink
withunreadLinkUrl
.
-
Click for example:
OLD {{ onsMessage({ "unreadLink": "www.google.com" }) }} NEW {{ onsMessage({ "unreadLinkUrl": "www.google.com" }) }}
- Locate all instances of
Update parameter subject from text to object type in Message list component
-
Description of change: In Message List component,
subject
parameter is changed to an object which containstext
andurl
parameter.url
parameter is moved inside subject -
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
subject
parameter, and includetext
andurl
within thesubject
.
-
Click for example
OLD {{ onsMessageList({ "messages": [{ "url": "#0", "subject": "survey response query", }] }) }} NEW {{ onsMessageList({ "messages": [{ "subject":{ "url": "#0", "text":"survey response query", } }] }) }}
- Locate all instances of
Add option for additional logo in footer
-
Description of change: The
poweredBy
parameter has been removed in favour offooterLogo
. -
Reason for change: This updates the footer component to support an additional logo, allowing for two logos instead of just one. It introduces the
link
param for each logo and offers an alternative layout option to display the logos on opposite sides of the footer. The default layout positions the logos next to each other. Additionally, the implementation is aligned with the header component's multipleLogo feature to ensure consistency across the application. The focus and hover states are also adjusted to avoid extra underlines and to ensure the highlight colour wraps only the SVG. -
Migration steps:
- Locate all instances of
poweredBy
in your codebase. - Replace
poweredBy
withfooterLogo
.
-
Click for example:
OLD {{ onsFooter({ "poweredBy": "<svg></svg>" }) }} NEW {{ onsFooter({ "footerLogo": { "logos": { "logo1": { "logoImage": '<svg></svg>', "logoUrl": "#0" }, } } }) }}
- Locate all instances of
Update parameter from link to text in Footer Component
-
Description of change: The
link
parameter has been renamed totext
in the Footer component. -
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
link
in the Footer component within your codebase. - Replace
link
withtext
.
-
Click for example:
OLD {{- onsFooter({ "OGLLink": { "link": "www.google.com" } }) }} NEW {{ onsFooter({ "OGLLink": { "text": "www.google.com" } }) }}
- Locate all instances of
Update parameter name from url to src in Image Component
-
Description of change: The
url
parameter has been renamed tosrc
in the Image component. -
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
url
in the Image component within your codebase. - Replace
url
withsrc
.
-
Click for example:
OLD {{ onsImage({ "url": "www.google.com" }) }} NEW {{ onsImage({ "src": "www.google.com" }) }}
- Locate all instances of
Update parameter names from LogoImage and LogoURL to image and url in header component
-
Description of change: In header component, renamed the
LogoImage
parameter toimage
andLogoURL
tourl
. -
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
LogoImage
andLogoURL
. - Replace
LogoImage
toimage
andLogoURL
tourl
.
-
Click for example
OLD {{ onsHeader({ "mastheadLogo": { "multipleLogos":{ "logo1": { "LogoImage": "ONS Logo", "LogoURL": "https://www.ons.gov.uk/" } } } }) }} NEW {{ onsHeader({ "mastheadLogo": { "multipleLogos":{ "logo1": { "image": "ONS Logo", "url": "https://www.ons.gov.uk/" } } } }) }}
- Locate all instances of
Update parameter name from url to linkUrl in feedback component
-
Description of change:
url
parameter is named tolinkUrl
-
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
url
parameter - Replace
url
tolinkUrl
.
-
Click for example
OLD {{ onsFeedback({ "url": "#0", }) }} NEW {{ onsFeedback({ "linkUrl": "#0", }) }}
- Locate all instances of
Rename summary component parameters
-
Description of change:
summary.summaryTitle
is renamed tosummary.title
group.groupTitle
is renamed togroup.title
row.rowTitle
is renamed torow.title
row.rowItems
is renamed torow.itemsList
rowItem.rowTitle
is renamed toitem.title
rowItem.rowTitleAttributes
is renamed toitem.titleAttributes
-
Reason for change: In this update, we are addressing an inconsistency in the naming of parameters within the summary component. This change aims to standardise the parameter names for clarity and consistency.
-
Migration steps:
- Locate all instances of the above parameters in your codebase.
- Replace old parameters with new parameters as per below example.
-
Click for example:
OLD {{ onsSummary({ "summaries": [ { "groups": [ { "placeholderText": 'test', "id": "turnover", "groupTitle": "Turnover", "rows": [ { "id": "sales-dates-row", "rowTitle": "What are the dates of the sales period you are reporting for?", "rowItems": [ { "id": "sales-dates", "valueList": [ { "text": "1 January 2015 to 2 February 2017" } ], "actions": [ { "text": "Change", "visuallyHiddenText": "Change answer", "url": "#0" } ] } ] } ] } ] } ] }) }} NEW {{ onsSummary({ "summaries": [ { "groups": [ { "placeholderText": 'test', "id": "turnover", "title": "Turnover", "rows": [ { "id": "sales-dates-row", "title": "What are the dates of the sales period you are reporting for?", "itemsList": [ { "id": "sales-dates", "valueList": [ { "text": "1 January 2015 to 2 February 2017" } ], "actions": [ { "text": "Change", "visuallyHiddenText": "Change answer", "url": "#0" } ] } ] } ] } ] } ] }) }}
Refactor timeline macro for compatibility with Jinja2 templates
-
Description of change: We have made a breaking change to the timeline macro by renaming the
items
parameter totimelineItems
. -
Reason for change: The reason the parameter is being renamed is to fix a bug which takes place in Jinja environments where "items" is a reserved word.
-
Migration steps:
- Locate all instances of
items
in your codebase within the timeline component. - Replace
items
withtimelineItems
.
-
Click for example:
OLD {{ onsTimeline({ "items": [. . . ], "titleTag": "h3" }) }} NEW {{ onsTimeline({ "timelineItems": [. . . ], "headingLevel" : 3 }) }}
- Locate all instances of
Update parameter names in document list component
-
Description of change::
type
has been renamed toobject
within the metadata object.- The title and url parameters have been combined into an object named title, which now contains text and url.
-
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
type
parameter and replace withobject
. - Locate all instances where
url
andtitle
were separate parameters. - Restructure title to include both text and url
-
Click for example
OLD {{ onsDocumentList({ "url": '#0', "title": 'ONS launches Integrated Data Service to boost government collaboration on data sharing', "metadata": { "type": { "text": 'Press releases', "ref": 'Ref 008052' }, }, }) }} NEW {{ onsDocumentList({ "title": { "text": 'ONS launches Integrated Data Service to boost government collaboration on data sharing', "url": '#0' }, "metadata": { "object": { "text": 'Press releases', "ref": 'Ref 008052' }, }, }) }}
- Locate all instances of
Update param name settingsLinkTextURL to settingsLinkURL in Cookies Banner component
-
Description of change:
settingsLinkTextURL
parameter is named tosettingsLinkURL
-
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
settingsLinkTextURL
parameter - Replace
settingsLinkTextURL
tosettingsLinkURL
.
-
Click for example
OLD {{ onsCookiesBanner({ "settingsLinkTextURL": "/cookiesoverride", }) }} NEW {{ onsCookiesBanner({ "settingsLinkURL": "/cookiesoverride", }) }}
- Locate all instances of
Update parameter names in card component
-
Description of change:
headingLevel
,id
,titleClasses
,title
, andurl
are now combined into atitle
object withheadingLevel
,id
,classes
,text
, andurl
properties.text
,textId
, anditemsList
have been consolidated into abody
object withtext
,id
, anditemsList
properties.
-
Reason for change: This update ensures consistency in parameter naming across the project.
-
Migration steps:
- Locate all instances of the
headingLevel
,id
,titleClasses
,title
, andurl
parameters. - Restructure these parameters into the
title
object, includingheadingLevel
,id
,classes
,text
, andurl
. - Locate all instances of the
text
,textId
, anditemsList
parameters. - Restructure these into the
body
object, containingtext
,id
, anditemsList
.
-
Click for example
OLD {{ onsCard({ "id": 'card-example', "textId": 'text', "title": 'Your data and security', "url": '#0', "text": 'How we keep your data safe and what happens to your personal information.', "headingLevel": 2, "classes": "random-class", "itemsList": [ { "url": '#0', "text": 'List item 1 about the census' }, { "url": '#0', "text": 'List item 2 about the census' } ] }) }} NEW {{ onsCard({ "title": { "id": 'card-example', "text": 'Your data and security', "url": '#0' "headingLevel": 2, "titleClasses": "random-class" }, "body":{ "id": 'text', "text": 'How we keep your data safe and what happens to your personal information.', "itemsList": [ { "url": '#0', "text": 'List item 1 about the census' }, { "url": '#0', "text": 'List item 2 about the census' } ] } }) }}
- Locate all instances of the
Update parameter from linkText to text in external link component
-
Description of change:
linkText
parameter is named totext
-
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
linkText
parameter in external link component - Replace
linkText
totext
.
-
Click for example
OLD {{ onsExternalLink({ "url": "#0", "linkText": "link to an external website" }) }} NEW {{ onsExternalLink({ "url": "#0", "text": "link to an external website" }) }}
- Locate all instances of
Update param name from title to text in section navigation component
-
Description of change: The
title
parameter for the objects itemsList and anchor is renamed totext
-
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of the
title
parameter in the objects itemList and anchor - Replace
title
withtext
.
-
Click for example
OLD {{ onsSectionNavigation({ "sections":[{ "itemsList": [{ "title": "Section 1" "anchors": [{ "title": "Sub section 1" }] }] }] }) }} NEW {{ onsSectionNavigation({ "sections":[{ "itemsList": [{ "text": "Section 1" "anchors": [{ "text": "Sub section 1" }] }] }] }) }}
- Locate all instances of the
Update parameter from linkText to videoLinkText in Video Component
-
Description of change:
linkText
parameter is named tovideoLinkText
-
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of
linkText
parameter in video component - Replace
linkText
tovideoLinkText
.
-
Click for example
OLD {{ onsVideo({ "linkText": "Example link text" }) }} NEW {{ onsVideo({ "videoLinkText": "Example link text" }) }}
- Locate all instances of
Update parameter from manualLink to manualLinkUrl in Address Input component
-
Description of change:
manualLink
parameter is renamedmanualLinkUrl
-
Reason for change: This update helps to standardise the parameter names within the project.
-
Migration steps:
- Locate all instances of the
manualLink
parameter in the Address Input component - Replace
manualLink
withmanualLinkUrl
.
-
Click for example
OLD {{ onsAddressInput({ "manualLink": "Example-manual-link" }) }} NEW {{ onsAddressInput({ "manualLinkUrl": "Example-manual-link" }) }}
- Locate all instances of the
Ensure list item custom attributes are always set on list item
-
Description of change: Custom list item attributes are now always set on the
<li>
element not the<a>
when using theurl
param. -
Reason for change: To make the application of custom attributes more consistent and allow they to be used without the need for a link.
-
Migration steps:
Some selectors (e.g. in automated tests or triggers in GA) may need to be updated as the attributes will now be on the parent element for the link element it was on before.
For further assistance, please reach out to our support team:
- Email: ons.design.system@ons.gov.uk