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 as an npm package, @guardian/stand, and developers should feel comfortable contributing.
This library is split into two main sections:
- Tools Design System
- The core design system and components used across the Guardian's internal tools.
- e.g. Colour, Typography, Buttons, Forms, etc.
- Editorial Components
- A collection of highly specific components shared across a smaller number of tools.
- e.g. Byline editor, Tag picker, etc.
Currently maintained by the P&E DevX E2E team, but open to contributions from anyone in the company. Do reach out for help or to get involved!
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:
See the peerDependencies in package.json for compatible versions and install them.
If you're using the Tools Design System, you may also want to install the compatible version of react-aria-components.
For specific Editorial Components, check the documentation for each component for additional dependencies.
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.
See the Tools Design System and Editorial 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 Editorial 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 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 manage design tokens.
Tokens are defined in src/styleD/tokens/, the generated outputs live in src/styleD/build/, and both are committed to the repository. During the package build, Rollup copies the build outputs into dist/styleD/build/ for publishing.
Most foundation tokens are generated from Figma variables, see scripts/figma/README.md for details.
After making changes to any token files, regenerate the outputs and commit them:
pnpm build-styledSee the Style Dictionary documentation for more details on how we structure and generate the styles.
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 three variables (REACT_VERSIONS, EMOTION_VERSIONS, TS_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.