Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Shopify Engineering 6 min read Case study mediumAdept

Creating a React Library for Consistent Data Visualization

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.

Related posts

  • Theming the Zalando Design System

    Zalando Engineering mediumAdept

    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. Colour schemes (default, monochrome-dark, monochrome-light) are first-class within each theme to meet contrast requirements on image-derived banner backgrounds, which raises open questions about native dark mode. Tokens live in TOML files processed by Style Dictionary with custom transforms and formats that emit platform-specific artefacts for web, Android and iOS. Each theme is a partial dictionary deep-merged over the base theme. The tokenization process also simplified the design system and improved cross-platform parity.

  • Building a Form with Polaris

    Shopify Engineering mediumAdept

    A step-by-step tutorial builds a Shopify-style Add Product form using Polaris React components (Form, FormLayout, TextField, Page, Card). Along the way it shows why an AppProvider wrapper is required for global i18n context, and how to use FormLayout for spacing, Page props for breadcrumbs, title and primary actions, and Card's sectioned prop for padding. It then turns the form into a controlled React form with useState, onChange handlers and a submit handler wired to the Page's primary action.

  • The shared language of props

    Figma mediumAdept

    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. A case study from a React/TypeScript app built on Material UI shows two Figma button components mapping to five code components layered over a ButtonPrimitive, which used types to make aria-label required for icon-only buttons. The practical advice is to align variant names and casing where possible, mark Figma-only concepts like interaction state with a prefix such as ":state", and accept differences like disabled being a boolean prop in code.

  • Illuminating dark mode

    Figma mediumAdept

    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. Tokens are exported in the Design Tokens Format Module spec and compiled to CSS, Swift and XML. To spread the mostly manual refactor, forty engineers covered about 80% of in-scope surfaces in a single 'Dark Mode Week'. Supporting tooling included CSS fallbacks to the legacy variables to prevent regressions, a debug theme with random saturated colors to reveal unconverted surfaces, and a CIELAB-based search tool for finding the closest matching token.

  • How Thumbtack structures their design system

    Figma mediumAdept

    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. Higher layers trade flexibility for productivity, accessibility and consistency. When a component doesn't fit, developers drop to a lower layer, such as the unstyled ModalCurtain under the styled Modal. That lets teams adopt the system incrementally and gives maintainers a way to spot popular workarounds without making one-off API changes. Publishing and documentation overhead is handled with a monorepo (Yarn Workspaces, Lerna), a GraphQL API over the tokens, and docs that make the happy path prominent and the escape hatches subtle.

The quest for software engineering knowledge.

Look:
Layout: