How patternfly/patternfly-react works
1. What this repo is
- This is a Lerna-managed monorepo for the PatternFly React design system.
- The main output is a set of published React packages plus supporting packages for docs, tests, styling, icons, tokens, and developer tooling.
2. Top-level package boundaries
- The repo is split into independently versioned packages such as react-core, react-table, react-charts, react-icons, react-styles, react-tokens, react-code-editor, react-templates, react-drag-drop, and react-docs.
- react-integration is a separate validation surface for browser-level testing, not a library package.
3. Core UI library (react-core)
- packages/react-core is the largest subsystem and contains the bulk of PatternFly components.
- Its internal structure is organized by components, layouts, helpers, styles, demos, and deprecated APIs.
- Most components are small compositional React primitives with dedicated tests, snapshots, and example files.
4. Component composition model
- Many core components are split into a primary container plus subcomponents, contexts, and utility modules.
- Examples include Modal, Wizard, Tabs, Menu, Page, Toolbar, Popover, Dropdown, DataList, Drawer, and Alert, each with supporting parts under the same folder.
- This makes the architecture mostly component-local, with shared helpers used only where cross-cutting behavior is needed.
5. Shared helpers and behavior
- react-core/src/helpers contains reusable infrastructure for cross-component concerns: focus trapping, resize observation, SSR-safe IDs, Popper positioning, keyboard handling, animation support, and OUIA metadata.
- These helpers are the main “behavior layer” beneath UI components and are the bridge to browser APIs like layout measurement, focus management, and positioning.
6. Layout primitives
- react-core/src/layouts contains low-level layout building blocks such as Flex, Grid, Stack, Split, Bullseye, Gallery, and Level.
- These are meant to be composed by higher-level components and demos, so they act as the spacing/alignment foundation for the UI system.
7. Styling and design tokens
- react-styles owns the CSS output and class map generation, while react-tokens owns the design token generation.
- react-core and other packages consume these layers through generated class maps, CSS imports, and token-driven styling utilities.
- The styling boundary is important: visual consistency comes from shared style artifacts rather than per-component ad hoc CSS.
8. Icon system
- react-icons is a generated icon package with scripts that pull from multiple icon sources and write React icon components.
- This package is a distinct asset pipeline: source icon definitions are transformed into reusable React components, then consumed by the UI packages.
9. Table and charts are separate specialized engines
- react-table is a dedicated table subsystem with its own base layer, decorators, formatters, transformers, and a deprecated table implementation alongside the current one.
- react-charts contains chart wrappers for both Victory-based and ECharts-based implementations, with shared chart theme utilities and component-specific examples/tests.
- These are not just “components”; they have internal rendering and data-shaping pipelines that are more specialized than the rest of react-core.
10. Template and extension packages
- react-templates provides precomposed dropdown/select patterns built on top of the core primitives.
- react-drag-drop provides drag-and-drop helpers and wrappers used by higher-level components like tables and dual list selectors.
- react-code-editor is a focused package for embedding and configuring code editor experiences.
11. Docs and example generation
- react-docs is a Gatsby-based documentation site with generated content under patternfly-docs/generated.
- The repo also keeps component examples and demos inside the packages, which serve as both documentation artifacts and integration examples.
- The docs pipeline consumes these generated examples to present live component usage rather than handwritten prose alone.
12. Testing strategy
- Most component packages use unit tests plus snapshot tests with Jest.
- react-integration adds Cypress coverage for end-to-end browser behavior across real demo scenarios.
- This creates a two-layer validation model: fast structural/component testing and slower runtime integration testing.
13. Generated and deprecated surfaces
- Several directories are explicitly generated or machine-maintained, such as icon sources, token outputs, class maps, subpath exports, and docs artifacts.
- Deprecated APIs are preserved under deprecated/ in packages like react-core and react-table, which helps maintain backward compatibility while separating them from current APIs.
14. Build, packaging, and release tooling
- The repo uses Yarn, Lerna, Rollup configs in individual packages, Babel/Jest/ESLint/Prettier, and multiple custom scripts under scripts/ and .github/.
- Important repo-wide scripts handle subpath export generation, single-package builds, changelog/release steps, and source transformation for CommonJS/ESM interop.
- Architecture-wise, this means the repo is optimized for multi-package publishing, not a single app deploy.
15. Overall flow
- Design tokens and styles are generated first, then consumed by component packages.
- Components and layout primitives are composed into demos/examples.
- Tests and Cypress specs validate the components against those demos.
- Docs generation turns the same examples into published documentation content.
Main entry points: react-core react-core · lerna.json Lerna · react-table react-table · scripts Scripts
Components 23
Monorepo
Lerna-managed PatternFly React repository
- Lerna · Workspace and versioning coordinator
lerna.json
UI packages
Published component and asset packages
- react-core · Primary PatternFly React component package
packages/react-core - Components · Core component implementations and subcomponents
packages/react-core/src/components - Layouts · Flex, Grid, Stack and other composition primitives
packages/react-core/src/layouts - Helpers · Focus, IDs, Popper, resize and browser-adjacent helpers
packages/react-core/src/helpers - Demos · Packaged demos and generated usage examples
packages/react-core/src/demos - Deprecated · Preserved legacy component surfaces
packages/react-core/src/deprecated - react-styles · Generated CSS and class map artifacts
packages/react-styles - react-tokens · Design token generation and outputs
packages/react-tokens - react-icons · Generated React icon components from source icon sets
packages/react-icons - react-templates · Precomposed dropdown and select patterns
packages/react-templates - react-code-editor · Embedded code editor component package
packages/react-code-editor
Specialized engines
Table and charts subsystems with their own pipelines
- react-table · Specialized table rendering and behavior package
packages/react-table - Table base · Base provider, transforms and formatters for tables
packages/react-table/src/components/Table/base - Table utils · Decorators and transformers for table features
packages/react-table/src/components/Table/utils - react-charts · Victory and ECharts chart package
packages/react-charts - Victory charts · Victory-based chart components and utilities
packages/react-charts/src/victory - ECharts charts · ECharts-based chart wrappers and theme helpers
packages/react-charts/src/echarts
Docs and validation
Documentation site and integration testing surface
- react-docs · Gatsby-based documentation site with generated content
packages/react-docs - Generated docs · Machine-generated docs pages and demo content
packages/react-docs/patternfly-docs/generated - react-integration · Browser-level validation surface with Cypress and demo app
packages/react-integration - Demo app · Vite demo application used by Cypress scenarios
packages/react-integration/demo-app-ts
Tooling
Repo-wide scripts and development support
- Scripts · Repo-level generators, builds and release helpers
scripts
Connections 34
- Lerna → react-core: manages · Workspace package boundary
- Lerna → react-table: manages · Workspace package boundary
- Lerna → react-charts: manages · Workspace package boundary
- Lerna → react-icons: manages · Workspace package boundary
- Lerna → react-styles: manages · Workspace package boundary
- Lerna → react-tokens: manages · Workspace package boundary
- Lerna → react-templates: manages · Workspace package boundary
- Lerna → react-code-editor: manages · Workspace package boundary
- Lerna → react-docs: manages · Workspace package boundary
- Lerna → react-integration: manages · Workspace package boundary
- react-core → Components: contains · Primary component implementations
- react-core → Layouts: contains · Foundational layout primitives
- react-core → Helpers: contains · Cross-cutting browser behavior
- react-core → Demos: ships · Examples and demo content
- react-core → Deprecated: retains · Legacy API surface
- react-tokens → react-styles: feeds · Token output informs styling artifacts
- react-styles → react-core: styles · Shared CSS and class maps consumed by components
- react-icons → react-core: consumed by · Generated icon components used across UI packages
- react-templates → react-core: builds on · Composed from core primitives
- react-code-editor → react-core: builds on · Editor package integrates with core patterns
- react-table → Table base: organizes · Rendering/provider foundation
- react-table → Table utils: organizes · Decorators, formatters and transformers
- react-table → react-core: uses · Table UI composes core primitives and styles
- react-charts → Victory charts: contains · Victory chart implementation
- react-charts → ECharts charts: contains · ECharts chart implementation
- react-charts → react-core: uses · Charts rely on shared UI and helpers
- react-docs → Generated docs: serves · Published documentation output
- react-docs → react-core: documents · Consumes examples and generated demos
- react-integration → Demo app: runs · Cypress tests exercise the demo app
- react-integration → react-core: validates · Browser-level behavior across component demos
- Scripts → react-core: builds · Package generation and release support
- Scripts → react-table: builds · Package generation and release support
- Scripts → react-icons: generates · Icon and export generation pipeline
- Scripts → react-tokens: generates · Token build and write pipeline