### Install PrimeFlex
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Installs PrimeFlex version 2.0.0 using npm. This is the initial step for integrating PrimeFlex into an existing application.
```bash
npm install primeflex@2.0.0 --save
```
--------------------------------
### Flexbox Horizontal Spacing Example
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Example showing horizontal spacing using margin utilities in a flex container.
```html
```
--------------------------------
### Flexbox Vertical Spacing Example
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Example demonstrating vertical spacing using margin utilities for items in a flex column.
```html
Item 1
Item 2
```
--------------------------------
### PrimeFlex Display Utilities
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Shows examples of using PrimeFlex's display utility classes (p-d-*) for controlling element display properties, including responsive variations based on screen size breakpoints (sm, md, lg, xl) and print visibility.
```html
Displayed as inline.
Displayed as a flexbox container.
Inline for larger screens and block for others.
Visible on a Small Screen
Hidden on a Small Screen
Only visible when printed.
Not available for printing.
```
--------------------------------
### PrimeFlex 12-Column Grid Layouts
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Illustrates the PrimeFlex 12-column grid system. Columns can be defined with specific widths using 'p-col-{number}' classes. This example shows a column taking 4 units of space, with others auto-adjusting, and another example with explicit column widths.
```html
4
1
1
1
1
1
1
1
1
2
6
4
```
--------------------------------
### Flexbox Align Self Example
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Demonstrates the usage of 'align-self' classes to control individual item alignment within a flex container.
```html
Start
Center
End
Stretch
```
--------------------------------
### Nested Columns
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Columns can be nested within each other to create more complex and structured layouts. This example shows a main 8-column layout containing its own grid.
```html
6
6
12
4
```
--------------------------------
### PrimeFlex Flexbox Align Items Classes
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Aligns flex items along the cross axis of the container. Options include start, end, center, baseline, and stretch, with responsive variations available.
```html
Item 1
Item 2
```
```html
Item 1
Item 2
```
--------------------------------
### PrimeFlex Flexbox Justify Content Classes
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Aligns flex items along the main axis of the container. Supports various alignment options like start, end, center, between, around, and evenly, with responsive variants.
```html
Item 1
Item 2
```
```html
Item 1
Item 2
```
--------------------------------
### Import PrimeFlex CSS
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Demonstrates two methods for including PrimeFlex CSS in an application: via a CDN link or through an import statement for bundlers.
```html
```
```javascript
import 'primeflex/primeflex.css';
```
--------------------------------
### Responsive Form Layout with PrimeFlex
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Implements a responsive form layout using PrimeFlex utility classes. It demonstrates how to structure form fields for different screen sizes, ensuring a consistent user experience across devices.
```html
```
--------------------------------
### FormLayout Vertical Grid Layout
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Illustrates how to create a multi-column vertical form layout using '.p-formgrid' and '.p-grid' for responsive design.
```html
```
--------------------------------
### Basic PrimeFlex Grid System
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Demonstrates the fundamental PrimeFlex grid system. A container with the 'p-grid' class and child elements with 'p-col' class create a basic flexbox-based layout where columns share space equally.
```html
1
2
3
```
--------------------------------
### PrimeFlex Responsive Grid Layouts by Breakpoint
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Illustrates responsive design in PrimeFlex using breakpoint-specific classes. Columns adapt their layout based on screen size: 'p-col-12' for all sizes, 'p-md-6' for medium devices, and 'p-lg-3' for large screens, resulting in 4 columns.
```html
A
B
C
D
```
--------------------------------
### PrimeFlex Elevation Utility
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Demonstrates how to apply elevation styles to elements using the p-shadow-{level} classes, with levels ranging from 1 to 24.
```html
```
```html
```
--------------------------------
### PrimeFlex Flexbox Container
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Illustrates how to define an element as a flexbox container using either the p-d-flex or p-d-inline-flex utility classes.
```html
Flex Container
Inline Flex Container
```
--------------------------------
### FormLayout Basic Structure
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Shows the fundamental structure of a form field using the '.p-field' class to wrap labels and inputs.
```html
```
--------------------------------
### Spacing Utilities
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Spacing utilities use the p-{property}{position}-{value} syntax for general spacing and p-{property}{position}-{breakpoint}-{value} for responsive spacing. Properties include margin (m) and padding (p), positions cover all sides (blank), specific sides (t, b, l, r), or axes (x, y). Values range from 0 to 6, with 'auto' available for margins.
```html
Margin bottom with level 2
Margin top with level 4
Margin for all sides with level 2
Auto margins for left and right side
Padding bottom with level 4
Padding for all sides with level 1
Level 3 spacing for lg screens and level 1 for smaller screens (xs).
```
--------------------------------
### PrimeFlex Flexbox Order Classes
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Provides classes to control the order of flex items within a container. Supports responsive adjustments based on screen size. Uses the 'order' CSS property.
```html
Item 1
Item 2
Item 3
```
```html
Item 1
Item 2
Item 3
```
--------------------------------
### PrimeFlex Flexbox Wrap Classes
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Controls how flex items wrap within a container when there isn't enough space. Includes options for nowrap, wrap, and wrap-reverse, with responsive variants.
```html
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
```
```html
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
```
```html
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
```
--------------------------------
### Input Field with Helper Text
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Shows how to add helper text to an input field using a `` tag with an `id` that is referenced by the input's `aria-describedby` attribute. The `.p-field` and `.p-fluid` classes are used for form structure.
```html
Enter your username to reset your password.
```
--------------------------------
### Inline Form Layout
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Implements an inline form layout using the `.p-formgroup-inline` class. It includes input fields and a submit button on the same row. The `.p-sr-only` class is used for screen reader accessibility on labels.
```html
```
--------------------------------
### Text Alignment
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Text alignment utilities provide options for left, center, right, and justify alignment for text content within elements.
```html
Left
Center
Right
Justify
```
--------------------------------
### FormLayout Vertical Fluid Layout
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Demonstrates a vertical form layout where components automatically occupy full width when within a '.p-fluid' container.
```html
```
--------------------------------
### Horizontal Form with Fixed Width Labels
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Demonstrates a horizontal form layout where labels have a fixed width, and input fields occupy the remaining space. This is achieved using `.p-col-fixed` for labels and `.p-col` for input containers.
```html
```
--------------------------------
### Text Style
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Text style utilities apply font weight and style changes, including bold, normal, light, and italic.
```html
Bold
Normal
Light
Italic
```
--------------------------------
### Horizontal Form with Fluid Layout
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Shows a fluid horizontal form layout by applying the `.p-fluid` class to the form container and using responsive grid classes like `.p-col-12` and `.p-md-10` for input elements.
```html
```
--------------------------------
### PrimeFlex Multi-Line Grid Behavior
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Shows how PrimeFlex handles multi-line layouts. When the total column width exceeds the container's width (e.g., two 'p-col-6' columns on a line), subsequent columns wrap to the next line.
```html
6
6
6
6
```
--------------------------------
### Text Wrapping
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Text wrapping utilities control how text behaves when it exceeds its container's width. Options include nowrap, wrap, and truncate.
```html
Long text wraps and does not overlow.
Long text does not wrap and overflows the parent.
Long text does not wrap and overflows the parent.
```
--------------------------------
### Vertical and Horizontal Checkbox Layouts
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Demonstrates layout options for checkboxes. Vertical layout uses `.p-field-checkbox`, while horizontal layout combines `.p-formgroup-inline` with `.p-field-checkbox`.
```html
Vertical Checkbox
Horizontal Checkbox
```
--------------------------------
### Vertical and Horizontal RadioButton Layouts
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Illustrates layout options for radio buttons. Vertical layout uses `.p-field-radiobutton`, and horizontal layout uses `.p-formgroup-inline` with `.p-field-checkbox` (note: `.p-field-checkbox` is used here for styling consistency with checkboxes in inline groups).
```html
Vertical RadioButton
Horizontal RadioButton
```
--------------------------------
### PrimeFlex Fixed Width Column
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Demonstrates how to create a column with a fixed width in PrimeFlex. Applying the 'p-col-fixed' class to a column allows it to maintain its specified width while other sibling columns adjust automatically.
```html
Fixed
Auto
```
--------------------------------
### Offset Columns
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Offset classes are used to define a left margin on a column, avoiding empty columns for spacing. Classes range from p-col-offset-1 to p-col-offset-12 and have responsive variants for different screen sizes.
```html
6
4
4
```
--------------------------------
### Gutter Control
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
PrimeFlex applies a .5rem padding to columns, creating gutters. These gutters can be removed by applying the .p-nogutter class to the container or individual columns.
```html
1
2
3
```
--------------------------------
### PrimeFlex Flexbox Direction
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Shows how to control the direction of flex items within a flex container using p-flex-{direction} classes (row, row-reverse, column, column-reverse), including responsive adjustments.
```html
Item 1
Item 2
Item 3
```
```html
Item 1
Item 2
Item 3
```
```html
Item 1
Item 2
Item 3
```
--------------------------------
### Text Transformation
Source: https://github.com/primefaces/primeflex/wiki/PrimeFlex-v2
Text transformation utilities allow changing the case of text to lowercase, uppercase, or capitalize.
```html