This is the home for all of PF9's UI React components
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Transpiles TypeScript source code to JavaScript. These files are stored in the built folder
- In your app root directory, run
yarn add https://github.com/platform9/ui-components - Import the components you want to use from the
builtfolder. Ex.import Theme from 'pf9-ui-components/built/theme-manager/themes/model' - If you want to sync your changes from ui-components to your app, run
yarn upgrade pf9-ui-components
- Run
yarn startto run the app - Make the changes you need to make in the code
- Run
yarn build - Commit and push your changes to the main branch
- To update your changes in the app that is using this component library, run
yarn upgrade pf9-ui-components
Storybook is used to create an isolated development environment and showcase the components. This helps speed up development as we can control the data / props that are feed into the component.
To see the Storybook just run:
src/elements/– low-level, reusable building blocks (buttons, inputs, grid, badge, card, tooltip, etc.).src/components/– higher-level, opinionated components that compose elements into PF9-specific UX patterns.src/theme-manager/– theming primitives and helpers (PF9 color palette, typography, component-level theme config).src/providers/,src/containers/,src/hooks/,src/utils/– supporting building blocks used by elements/components.
When published, the compiled code lives under the built/ folder with a similar structure (built/elements, built/components, etc.).
This project uses Create React App's Jest setup with React Testing Library:
- Run the test watcher:
yarn test
- Recommended conventions:
- Unit tests live next to the code as
*.test.tsx/*.test.ts. - Use Testing Library to assert on rendered output and behavior (not implementation details).
- Unit tests live next to the code as
Suggested focus areas:
- Elements – verify visual states and basic behavior of primitives:
- Buttons, inputs, toggles, dropdowns, badges, tooltips, grid cells/rows, etc.
- Components – verify composition and higher-level workflows:
- Validated forms, steppers, card/table composites, widgets, dialogs, etc.
Storybook stories in src/stories/ can be used as a reference for realistic props and states when designing tests.