---
title: "Creating a React Library for Consistent Data Visualization"
description: "Shopify's Polaris Viz React charting library replaced scattered per-chart style props with a single `theme` prop backed by a typed Theme record, removing visual inconsistencies across the admin."
url: "https://swe.quest/articles/creating-a-react-library-for-consistent-data-visualization-ab1526a6f8337781"
canonical: "https://shopify.engineering/react-library-consistent-data-visualization"
source: "Shopify Engineering"
published: "2022-03-15"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["design-systems","react","frontend","api-design"]
---

# Creating a React Library for Consistent Data Visualization

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2022-03-15, 6 min read, Case study. Original: [https://shopify.engineering/react-library-consistent-data-visualization](https://shopify.engineering/react-library-consistent-data-visualization)

## Summary

Shopify's Polaris Viz React charting library replaced scattered per-chart style props with a single \`theme\` prop backed by a typed Theme record, removing visual inconsistencies across the admin. A PolarisVizProvider context lets consumers override the Default and Light themes or define their own. \`createTheme\` fills partial themes with library defaults or with a supplied base theme, and \`createThemes\` guarantees the built-in themes always exist. Individual data series can still override theme colors for data-driven highlighting such as green or red gradients.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Design systems](https://swe.quest/tags/design-systems.md) (Web & mobile)
- [React](https://swe.quest/tags/react.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)

## Prerequisites

- React context and props ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- TypeScript types ([easy posts on TypeScript](https://swe.quest/tags/typescript.md?difficulty=easy))

## Keywords

Polaris Viz, PolarisVizProvider, React, Shopify Polaris

## Related posts

- [Theming the Zalando Design System](https://swe.quest/articles/theming-the-zalando-design-system-b14098d887a4b230.md): Zalando Engineering · 2024-05-13 · Medium · 20 min read · Design systems, Frontend, CSS, Mobile
  Zalando built theming into its design system by extracting repeated values into semantic design tokens (e.g. \`accent\` instead of \`orange\`) and adding component-level tokens that reference global ones, so themes can change a button's padding without redefining global scales.
- [Building a Form with Polaris](https://swe.quest/articles/building-a-form-with-polaris-d4ca8886da5d9a68.md): Shopify Engineering · 2022-06-01 · Medium · 13 min read · React, Design systems, Frontend
  A step-by-step tutorial builds a Shopify-style Add Product form using Polaris React components (Form, FormLayout, TextField, Page, Card).
- [The shared language of props](https://swe.quest/articles/the-shared-language-of-props-ff2798f5935efff7.md): Figma · 2023-07-19 · Medium · 17 min read · Design systems, React, TypeScript, Accessibility, Frontend
  Figma component properties and codebase component props share names but serve different purposes: design props mark visual differences, while code props also carry behaviour, events and data.
- [Illuminating dark mode](https://swe.quest/articles/illuminating-dark-mode-f998d746316f5fd8.md): Figma · 2022-07-21 · Medium · 15 min read · Design systems, CSS, Frontend, Refactoring & migrations, Accessibility
  Figma built dark mode by replacing roughly 5,100 build-time PostCSS color variables with runtime CSS custom properties based on a semantic token schema (Type | UI Element | Color role | Prominence | Interaction), so new themes only require reassigning token values.
- [How Thumbtack structures their design system](https://swe.quest/articles/how-thumbtack-structures-their-design-system-88dae4da18cdc3ea.md): Figma · 2023-07-13 · Medium · 8 min read · Design systems, Frontend, React, CSS
  Thumbtack's Thumbprint design system is organized in three layers: design tokens shared by web and native, an atomic CSS library built on the tokens, and accessible React components on top.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
