PrimeFlex is a CSS utility library featuring various helpers such as a grid system, flexbox, spacing, elevation and more. Although it is not required, it is highly recommended to add PrimeFlex as it is likely to need such utilities when developing applications with PrimeFaces.
PrimeFlex is available at GitHub. Download primeflex.min.css, add it to your application and include the path usign the h:outputStylesheet component.
PrimeFaces Showcase refers to version 3.3.1 of PrimeFlex.
<h:outputStylesheet name="%YOUR_PATH%/primeflex.min.css" />
Or use WebJars...
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>primeflex</artifactId>
<version>3.3.1</version>
</dependency>
<h:outputStylesheet library="webjars" name="primeflex/3.3.1/primeflex.min.css" />
PrimeFlex is a lightweight library, still it is possible to pick the utilities you need to make the file even smaller. For this, you need to remove the include paths and create your own build by compiling it with SASS. For example, if you do not need to use the elevation utilities, comment it out and build your own file. Note that sass cli should be available in your system, refer to documentation for details.
@import './src/_variables';
@import './src/_grid';
@import './src/_formlayout';
@import './src/_display';
@import './src/_text';
@import './src/flexbox/_flexbox';
@import './src/_spacing';
@import './src/_elevation';
sass --update primeflex.scss:primeflex.min.css --style compressed
Predefined values like breakpoints can be customized when creating your own build using the src/_variables file.
Variable | Description | Default |
---|---|---|
$sm | Breakpoint of screens such as phones. | 576px |
$md | Breakpoint of screens such as tablets. | 768px |
$lg | Breakpoint of screens such as notebook monitors. | 992px |
$xl | Breakpoint of smaller screens such as desktop monitors. | 1200px |
$gutter | Padding of a grid column. | .5rem |
$fieldMargin | Spacing of a field. Can be vertical of horizontal depending on form layout. | .5rem |
$fieldLabelMargin | Spacing of a field label. Can be vertical of horizontal depending on form layout. | .5rem |
$helperTextMargin | Top spacing of a helper text. | .5rem |
$spacer | Base value to use in spacing utilities, view spacing documentation for details. | .5rem |