- This assumes an environment is already set up for npm packages - if not, please use npm init following the steps at https://docs.npmjs.com/getting-started/using-a-package.json.
npm install @patternfly/patternfly --save
When you install PatternFly 4, the package includes:
- a single file for the entire compiled library:
- individual files with each component compiled separately:
- a single file for the entire library's source (SASS):
- individual files for each component's source (SASS):
Any of the files above are meant for use in consuming the library. The recommended consumption approach will vary from project to project.
PatternFly 4 Development requires Node v12.0.0 or greater
To setup the PatternFly 4 development environment:
- clone the project
npm installfrom the project root
- open your browser to
After working on your contribution, check for accessibility violations.
Create components, layouts...
To create source file scaffolding for a new component, layout, utility, or demo, run the NPM script:
node generate <CamelName>
Below are the full options for this script:
Options: -f, --folder <folder> Source folder (components, demos, layouts, or utilities) (default: "components")
To create a "Test component" component (
node generate TestComponent
To create a "Test layout" layout (
node generate TestLayout -f layouts
To create 3 new demos named "Test demo", "Test demo 2", and "Test demo 3", run:
node generate TestDemo TestDemo2 TestDemo3 -f demos
When making visual changes to a full page example, new example preview screenshots must be generated. To update the screenshots:
- open a terminal and run
npm run buildand
npm run serve
- in another terminal, run
npm run screenshots
Guidelines for CSS development
- For issues created in Core that will affect a component in PF-React, a follow up issue must be created in PF-React once the Pull Request is merged. The issue should include the Core PR #, the Core Release, a link to the component in https://pf4.patternfly.org, and information detailing the change.
- If global variables are modified in Core, a React issue should be opened to address this.
- CSS developers should ensure that animation is well documented and communicated to the respective React developer.
- Once the component/enhancement is complete it should receive sign off from a visual designer who can then update the master sketch file with any changes.
When creating a brand new component, it should be released as beta in order to get feedback.
Testing for accessibility
How to perform an accessibility audit with aXe
aXe is available as either a browser extension or npm script.
To run the a11y audit locally:
- install the latest chromedriver and ensure its available on your system
- macOS users can simply
brew cask install chromedriver
- macOS users can simply
npm run dev
npm run a11y(in another console)
The tool is configured to return WCAG 2.0 AA violations for the full page renderings of all components, layouts, utilities, and demos. The tool will provide feedback about what the violation is and a link to documentation about how to address the violation.
Ignore the violations that aren’t related to your contribution.
Fix violations related to your contribution.
If there are violations that are not obvious how to fix, then create an issue with information about the violation that was found. For example, some violations might require further discussion before they can be addressed. And some violations may not be valid and require changes to the workspace or tooling to stop flagging the violation.
If you have any suggestions about ways that we can improve how we use this tool, please let us know by opening an issue.
PatternFly 4 is supported on the latest two major versions of the following browsers: