npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ukhomeoffice/frontend-toolkit

v2.13.1

Published

Implementation of github.com/UKHomeOffice/design-system for use in projects

Downloads

21

Readme

frontend-toolkit

Implementation of the Home Office design system for use in projects

HTML components

HTML components are shipped as nunjucks macro functions for maximal compatability with the GDS prototype kit.

Usage

To use a component inside a nunjucks template, first import the component, then call as a function:

{% from "components/header.html" import header %}
{{ header(title='Frontend toolkit') }}

Using with express

Include the components in your app's views stack:

app.set('views', [require('@ukhomeoffice/frontend-toolkit').views, '<your app views directory>']);

This will allow simple reference to the components when using them in templates.

Using without express

If you are not using express, and so cannot make use of its views stack, then you will need to provide a full path when importing components. The easiest way to do this is to expose a componentPath property to your templates.

{% set componentPath = '/path/to/frontend/toolkit/templates/' %}
{% from componentPath + "components/header.html" import header %}
{{ header(title='Frontend toolkit') }}

Components

The following components are available:

Styles

The default css styles are provided as sass files. To include these in a project add the following line to your project's sass:

@import "@ukhomeoffice/frontend-toolkit";

Note: you will need to set the includePaths option in your sass compiler to include your project's local node_modules directory.

Components

The header and footer styling is automatically included with the core styles. For all other components, including the proxies to govuk-frontend components, you will need to import each sass file individually:

@import '@ukhomeoffice/frontend-toolkit/assets/styles/components/breadcrumbs';
@import '@ukhomeoffice/frontend-toolkit/assets/styles/components/error-summary';
@import '@ukhomeoffice/frontend-toolkit/assets/styles/components/phase-banner';

Note: please be aware that the $govuk-font-family variable must be set in order to prevent govuk-frontend components injecting their own 'nta' font-face declarations into your compiled CSS. This is done by default in index.scss and can be overridden. If you choose to bring components directly into your project from govuk-frontend rather than via the proxies provided here, then you must make sure that $govuk-font-family is declared before those includes.

Colours

A number of colour variables are defined in sass as shortcuts

  • $ho-brand - #8F23B3 (alias $purple)
  • $background - #F3F3F3 (alias $light-grey)
  • $black - #0B0C0C
  • $white - #FFFFFF
  • $green - #3D5C00
  • $blue - #005EA5 (alias $ho-link)
  • $dark-grey - #3B3B3B
  • $mid-grey - #DADADA
  • $ho-focus - #FFBF47
  • $ho-link-visited - #4C2C92
  • $ho-link-hover - #2B8CC4 (alias $ho-link-active)
  • $ho-link-focus - #005798