All Projects → govuk-react → Govuk React

govuk-react / Govuk React

Licence: mit
An implementation of the GOV.UK Design System in React using CSSinJS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Govuk React

react-component-library-lerna
Build your own React component library managed with lerna, presented with storybook and published in private npm registry.
Stars: ✭ 55 (-74.89%)
Mutual labels:  styled-components, storybook, component-library
smores-react
🍭 Marshmallow React components
Stars: ✭ 34 (-84.47%)
Mutual labels:  styled-components, storybook, component-library
sodium-ui
Sodium is a simple, modular and customizable web component library to build elegant and accessible UI pieces for your React Application.
Stars: ✭ 23 (-89.5%)
Mutual labels:  storybook, component-library
React95
🌈🕹 Refreshed Windows 95 style UI components for your React app
Stars: ✭ 4,877 (+2126.94%)
Mutual labels:  component-library, styled-components
Moveit
🚀 NLW #4 | React+ TypeScript + NextJS + StyledComponents + Firebase + MongoDb +Axios
Stars: ✭ 39 (-82.19%)
Mutual labels:  styled-components, storybook
clockface
UI Kit for building Chronograf
Stars: ✭ 33 (-84.93%)
Mutual labels:  storybook, component-library
eleventy-react
Use React components in Eleventy.
Stars: ✭ 66 (-69.86%)
Mutual labels:  styled-components, storybook
Quantum
The default pack of components and layout principles that dictates Catho Frontend applications.
Stars: ✭ 39 (-82.19%)
Mutual labels:  styled-components, storybook
storybook-styled-components
No description or website provided.
Stars: ✭ 76 (-65.3%)
Mutual labels:  styled-components, storybook
Aura.ui
A Library with a lot of Controls for AvaloniaUI
Stars: ✭ 114 (-47.95%)
Mutual labels:  component-library, styled-components
Meteor Apollo Starter Kit
Meteor, Apollo, React, PWA, Styled-Components boilerplate
Stars: ✭ 91 (-58.45%)
Mutual labels:  styled-components, storybook
React95
A React components library with Win95 UI
Stars: ✭ 1,779 (+712.33%)
Mutual labels:  styled-components, storybook
personal-blog
✍️ 个人技术博客
Stars: ✭ 79 (-63.93%)
Mutual labels:  styled-components, storybook
weather-styled-icon
⛅️☀️🌧🌨in ⚛️
Stars: ✭ 23 (-89.5%)
Mutual labels:  styled-components, storybook
Lerna Yarn Workspaces Monorepo
🐉 A Monorepo with multiple packages and a shared build, test, and release process.
Stars: ✭ 201 (-8.22%)
Mutual labels:  styled-components, storybook
chic-ui
Lightweight CSS-in-JS styled UI Component Library for React
Stars: ✭ 39 (-82.19%)
Mutual labels:  styled-components, storybook
Orbit
React components of open-source Orbit design system by Kiwi.com
Stars: ✭ 774 (+253.42%)
Mutual labels:  component-library, styled-components
medly-components
🧩 Medly components provides numerous themable react components, each with multiple varitaions of sizes, colors, position etc.
Stars: ✭ 66 (-69.86%)
Mutual labels:  styled-components, storybook
Storybook Addon Styled Component Theme
storybook addon
Stars: ✭ 168 (-23.29%)
Mutual labels:  styled-components, storybook
Gatsby Starter Typescript Deluxe
A Gatsby starter with TypeScript, Storybook, Styled Components, Framer Motion, Jest, and more.
Stars: ✭ 50 (-77.17%)
Mutual labels:  styled-components, storybook

govuk-react

An implementation of the GOV.UK Design System in React using CSSinJS using Object notation (with styled-components).

Build Status codecov Join the community on Spectrum Greenkeeper badge

We aim to track the following projects (in priority order) as to which components to implement and how they should look/behave. Where possible we are using the existing CSS as a guide. When we need to modify to suit custom markup, we aim to provide a comment in our code as to why this was done.

Usage

npm install govuk-react styled-components --save
import { Button } from 'govuk-react'

const MyComponent = ({title}) => (<div>
  <h1>{title}</h1>
  <Button />
</div>)

See the Storybook for examples of all available components.

Also see the example project for basic usage.

Using Link with a Router Link

We provide a Link component which creates an element styled as a GDS link. As we are using styled-components it is possible to apply that style to an existing component using the as prop. Other props will be passed through.

For example;

import { BrowserRouter, Link as RouterLink } from 'react-router';
import { Link } from '@govuk-react/link';

const MyComponent = () => (
  <nav>
    <BrowserRouter>
      <Link as={RouterLink} to="https://example.com">example</Link>
    </BrowserRouter>
  </nav>
);

Assumptions

Use of these components assumes the following from the peer project:

  • Either normalize.css or sanitize.css is used as a CSS reset.
  • The GDS Transport font face is included (for gov.uk domains only)
  • Other than the reset, no other styles affecting generic elements (without classes, IDs etc) are present in the CSS.

Why CSS-in-JS?

See A Unified Styling Language.

This project is part of a larger initiative to componetise large scale React applications. Using CSSinJS allows us to include styles inside a module bundle that can be published (using npm publish) and consumed by a peer application, without putting dependencies on the peer application to implement a specific CSS build system.

We are expecting to use Interoperable Style Transfer Format (ISTF) once it is finalised and compatible with a CSSinJS library, which would allow us to distribute CSSinJS stylesheets without a runtime.

Why not use GDS styles/classes directly

  1. We want to be free to write different DOM structure and/or CSS that is more in keeping with a React and bem-ish architecture. (e.g. in React you often don't need to specify IDs for field inputs, and can wrap inputs with labels so that they are automatically associated. We want to leave the decision of whether to use input IDs to the parent project. GDS styles don't wrap inputs with labels and require IDs and for attributes).
  2. We want a parent project to not have to worry about a specific build system (e.g. for handling import styles.css, particularly if you want universal support) or including certain CSS files. We want a simple npm install govuk-react to be enough to get govuk styled components on to your page, irrespective of your build system.
  3. We want to distribute React applications as modules that have self contained styles. CSS in JS allows all styles to be contained in distributable JS modules that can be ported across projects.

About the GDS font

Unfortuantely the GDS transport font has a relatively restrictive license described on the gov.uk blog. We are investigating rendering an elegant alternative before falling back to Arial on issue 272.

Related sites and projects

GOV.UK

Other React component libraries

Acknowledgements

We use Chromaticqa for visual regression testing and it is awesome, you should too!

Contributors

Want to contribute? Checkout our Contributing page.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].