You can install NHS.UK frontend by copying our CSS, JavaScript and asset files into your project. If you install this way, you can try NHS.UK frontend in your application without having to make many changes.
In your live application, you should install using npm instead.
You'll not be able to:
- selectively include CSS for individual components.
- build your own styles or components based on the colour variables or typography and spacing mixins.
- use the component Nunjucks templates.
- Download the
nhsuk-frontend-<VERSION-NUMBER>.zipfile at the bottom of the latest NHS.UK frontend release note. - Unzip the zip file.
- Copy the
assetsfolder to the root of your project's public folder. This is so, for example,<YOUR-SITE-URL>/assets/favicons/favicon.icoshows thefavicon.icoicon in your users' browsers. - Copy the
.cssand.css.mapfiles to a stylesheets folder in the root of your project's public folder. This is so, for example,<YOUR-SITE-URL>/stylesheets/nhsuk-frontend-<VERSION-NUMBER>.min.cssshows the CSS file in your users' browsers. - Copy the
.jsand.js.mapfiles to a JavaScripts folder in the root of your project's public folder. This is so, for example,<YOUR-SITE-URL>/javascripts/nhsuk-frontend-<VERSION-NUMBER>.min.jsshows the JavaScript file in your users' browsers.
-
Create a page in your project using the following HTML (in your live application, you should use the Design system page template instead):
<!DOCTYPE html> <html lang="en"> <head> <title>Example - NHS.UK</title> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="/stylesheets/nhsuk-frontend-<VERSION-NUMBER>.min.css"> <script type="module" src="/javascripts/nhsuk-frontend-<VERSION-NUMBER>.min.js"></script> </head> <body> <script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' nhsuk-frontend-supported' : '');</script> <!-- component HTML --> </body> </html>
-
Replace
<VERSION-NUMBER>so the 2 filenames match the files you copied from NHS.UK frontend's GitHub repo. -
Go to the character count component on the Design system and copy the HTML from the first example.
-
Replace
<!-- component HTML -->with the character count HTML you copied. -
Run your application - you can check it works the same way as the character count component example by typing into the textarea.
You can now create pages using the Design system on the NHS digital service manual.