Find what you need on the (news)stand!
A tools component library and design system
Any tool should be able to make use of the components and design system as an npm package, @guardian/stand, and developers should feel comfortable contributing.
Stand contains two collections: the Tools Design System, our core design system foundations and UI components, and Shareable non-Design System Components, reusable components that sit outside the design system. Both are available through @guardian/stand; inclusion in Stand does not imply that the component is part of the design system.
- Tools Design System
- The core design system foundations and collection of components used across the Guardian's internal tools.
- e.g. Colour, Typography, Buttons, Forms, etc.
- Shareable non-Design System Components
- Reusable components outside the core design system. They may use design system styles, but are not required to follow all its guidelines or be verified by the design system team.
- e.g. Byline editor, Tag picker, etc.
Start with the Tools Design System collection for general-purpose UI building blocks. Look in the shareable components collection for more specialised reusable components. Using design tokens or composing design system components does not automatically make a component part of the design system.
Contributors should use the component placement guide to choose a collection on where to place a new component.
Currently maintained by the P&E Design Systems team, but open to contributions from anyone in the company. Do reach out for help or to get involved!
Find us in the P&E Design Systems chat.
Stand is built with React, Emotion, and TypeScript, but the design system is designed to be as framework-agnostic as possible in that styles can be used without these dependencies if needed.
- Documentation
- Install
- Usage
- Contributing
- Tasks
- Design Tokens and Style Dictionary
- Compatibility
- Documentation Site Map
All documentation is available on Github Pages Storybook, which is updated with the latest changes to the library.
The library is published to npm:
# With pnpm
pnpm add @guardian/stand
# or with npm
npm install @guardian/stand
# or with yarn
yarn add @guardian/standDepending on your project setup, you may also need to install peer dependencies.
My project uses React, Emotion, and TypeScript:
Alongside React, Emotion and TypeScript, most projects will also need react-aria-components, which many Stand components are built on:
pnpm add react-aria-componentsA few components need extra dependencies:
- DatePicker:
@internationalized/date - Byline:
prosemirror-model,prosemirror-state,prosemirror-view,prosemirror-keymap,prosemirror-history,prosemirror-dropcursorand@guardian/prosemirror-invisibles
Compatible version ranges are listed under peerDependencies in package.json.
My project doesn't (or can't) use React, Emotion, or TypeScript:
You can still use design tokens and styles from the Tools Design System. Import CSS variables and/or JS design tokens directly from the package. Every component has a "Custom Component Build" section in its documentation showing how to do this.
My project doesn't use JavaScript at all:
You can import CSS variables from the package, provided your build process supports importing CSS from node_modules. See the "Custom Component Build" section in each component's documentation. Not every component supports an interactive custom build, but the CSS variables are available if you only need the styles.
Most applications only need Open Sans and Guardian Headline. Load Guardian Text Egyptian too if you use the article-body-* typography tokens.
Open Sans is hosted on the Guardian CDN. You can load it with CSS @import, an HTML <link>, or from the package if your bundler supports CSS imports:
@import url('https://assets.guim.co.uk/fonts/open-sans/OpenSans.css');<link
rel="stylesheet"
href="https://assets.guim.co.uk/fonts/open-sans/OpenSans.css"
/>import '@guardian/stand/fonts/OpenSans.css';The design system only uses the bold (700) weight of Guardian Headline:
@font-face {
font-family: 'GH Guardian Headline';
src: url('https://assets.guim.co.uk/static/frontend/fonts/guardian-headline/full-not-hinted/GHGuardianHeadline-Bold.woff2')
format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
}For the Guardian Text Egyptian @font-face declarations and other options, see the Semantic Typography documentation and the guardian/fonts repo.
Components that take a symbol or string icon prop use the Material Symbols font, which is hosted on the Guardian CDN. We recommend the Outlined style:
@import url('https://assets.guim.co.uk/fonts/material-symbols/MaterialSymbolsOutlined.css');<link
rel="stylesheet"
href="https://assets.guim.co.uk/fonts/material-symbols/MaterialSymbolsOutlined.css"
/>import '@guardian/stand/fonts/MaterialSymbolsOutlined.css';Rounded and Sharp styles are also available. For those, and for using SVG icons instead, see the Icon documentation.
See the Tools Design System and Shareable non-Design System Components documentation for details.
See the Contributing guidelines for guidelines on contributing to this project. Project setup and common tasks are listed below.
If you are looking to use Stand in your project, see the Tools Design System or Shareable non-Design System Components documentation for installation and usage instructions.
The following steps are for developing the Stand library itself.
-
Install dependencies:
# With pnpm pnpm install -
Run Storybook: Most development is done within Storybook, which provides a live environment for building and testing components in isolation:
pnpm storybook
This will start Storybook at
http://localhost:6007. See the contributing guidelines for how to add new components and stories. -
Build the package for publishing:
pnpm build
To regenerate Style Dictionary design token outputs after changing any token files (see Design Tokens and Style Dictionary):
pnpm build-styled
-
Test:
pnpm test # unit tests (Jest) pnpm test:e2e # end-to-end tests (Playwright) pnpm test:react-matrix # compatibility matrix tests (see Compatibility) pnpm tsc # TypeScript type checking pnpm tsc6 # TypeScript 6 type checking pnpm lint # lint (pnpm lint:fix to auto-fix) pnpm format:check # formatting check (pnpm format:fix to auto-fix)
The Design Tokens specification provides standards upon which products and design tools can rely for sharing stylistic pieces of a design system at scale.
The project uses Style Dictionary to generate CSS and TypeScript token outputs from src/styleD/tokens/.
The shared Tools Design System tokens in src/styleD/tokens/base/base.json, src/styleD/tokens/semantic/semantic.json, and src/styleD/tokens/component/component.json are managed in Tokens Studio. All other token JSON files are maintained locally in this project. Shareable components and unverified Tools Design System components keep their component tokens local; after a component is verified, the design systems team moves its tokens to Tokens Studio and removes the local token file.
To change Tokens Studio managed tokens (verified Design System Components), liaise with the design systems team. The current manual process uses the Tokens Studio CLI from the project root to pull the latest tokens and regenerate the Style Dictionary outputs:
studio tokens pull
pnpm build-styledReview the pulled source and generated output changes before committing. An automated pull workflow is planned; until it is available, do not edit the managed files directly or pull tokens from Figma variables. For locally maintained token JSON, make changes in the project and regenerate the outputs:
pnpm build-styledSee the Design Tokens documentation for more details on token usage, ownership, and generated outputs.
See the peerDependencies in package.json for compatible versions of React and other dependencies.
Version sets for matrix testing live in ./scripts/deps-matrix-versions.json. The test script ./scripts/test-deps-matrix.sh reads this file first, then applies any environment overrides. Precedence is:
- Explicit env var (e.g.
REACT_VERSIONS="18.0.0 19.0.0") - Value from
deps-matrix-versions.json
All four variables (REACT_VERSIONS, EMOTION_VERSIONS, TS_VERSIONS, RAC_VERSIONS) must be defined after loading; otherwise the script exits with an error.
Matrix generation in CI uses the same JSON file in the workflow ../.github/workflows/stand-component-library-deps-matrix.yml to ensure consistency.
- Edit
./scripts/deps-matrix-versions.jsonwith new versions. - Run the matrix test locally:
./scripts/test-deps-matrix.sh
- (Optional) Narrow the matrix with overrides:
REACT_VERSIONS="18.0.0" EMOTION_VERSIONS="11.14.0" TS_VERSIONS="5.1" ./scripts/test-deps-matrix.sh
- Review results (table output and any failures). Fix issues or adjust code.
- Update
peerDependenciesinpackage.jsonto reflect the new minimum/tested range. - Open a PR, the CI pipeline will comment with the compatibility matrix.
- Keep versions in ascending order for readability.
- Remove deprecated versions only after confirming no downstream tool depends on them.
- Add a new version first, then run the matrix, then adjust
peerDependenciesonce green. - Changes to
peerDependenciesare always a breaking change, as per our recommendations.