Migration

Migration guide to PrimeNG v20.

PrimeNG v20 is an evolution rather than a revolution compared to v18/v19 that introduced the brand new theming architecture. V20 focuses on form enhancements along with the primeuix migration for shared theming between all Prime projects including PrimeVue, PrimeReact and the upcoming projects such as PrimeUI web components. As of v20, PrimeNG has switched PrimeNG to semantic versioning, and as a result changes are iterative, with a smooth migration strategy and no breaking changes. In the future versions, same approach will be put in action and migrations will be trivial with no breaking changes.

Our team has put in great deal of effort while updating PrimeNG, and there are no filed breaking changes in v20.

Form Enhancements

In this iteration, all form components have been reviewed and new demos for template-driven and reactive forms have been added. During this work, limitations have been identified and resolved as well. In addition, we've introduced a new property named invalid to the form components that you may use style a component as invalid. In previous versions, form components style themselves as invalid using a built-in style like the following.


.p-inputtext.ng-invalid.ng-dirty {
    border-color: ${dt('inputtext.invalid.border.color')};
}

This style is opinionated as it is specifally for invalid and dirty states ignoring other potential UX requirements like touched/untouched or form submit. In v20, the new invalid provides full control to highlight a component a invalid.


<input type="text" pattern="email" [invalid]="email.invalid && (email.touched || sampleForm.submitted)" />

This styling change is backward compatible, meaning the opinionated ng-invalid.ng-dirty class is still included however in future versions, it will be removed.

PrimeUIX Themes

PrimeUIX is a shared package between all Prime libraries, this shared approach allows PrimeTek teams to share theming and the Design team who is responsible for the Figma UI Kit to work on a single design file, which is the single source of truth. Prior to v20, PrimeNG has its own fork in default styles and for the design tokens @primeng/themes package is required. With v20, PrimeNG receives the styles from @primeuix/styles under the hood and the design tokens as theme presets are loaded from @primeuix/themes.

The components need to be adjusted to fit in the PrimeUIX theming by using the host element where applicable, as a result for the components that use host element (<p-* />) as their main container, the styleClass became obselete since native class attribute is already available on the custom element. Refer to the documentation of a particular component to find out if styleClass is deprecated.


<!-- Deprecated -->
<p-select styleClass="mx-auto" />

<!-- New -->
<p-select class="mx-auto" />

All of these changes are backward compatible, @primeng/themes use @primeuix/themes internally, and migration is easy as replacing the dependency @primeng/themes with @primeuix/themes in your application.

The following items are marked as deprecated. These are subject to soft deprecation, which means they are no longer recommended for use, but will remain available and will not be removed in future releases.

APIDeprecated SinceReplacementRemovalStatus
pTemplatev20ng-template with a template reference variableNonedeprecated
styleClass *(for host enabled components)v20classNonedeprecated
Global inputVariantv20inputVariantNonedeprecated
CamelCase Selectorsv20Kebab caseNonedeprecated
pButton iconPos, loadingIcon, icon and label propertiesv20pButtonIcon and pButtonLabel directivesNonedeprecated
Button plain propertyv20pButtonIcon and pButtonLabel directivesNonedeprecated
pButton buttonProps propertyv20Use button properties directly on the elementNonedeprecated
p-button badgeClass propertyv20badgeSeverity propertyNonedeprecated
AutoComplete minLength propertyv20minQueryLengthNonedeprecated
OrganizationChart preserveSpace propertyv20Obselete property, had no useNonedeprecated
Paginator dropdownAppendTo propertyv20appendToNonedeprecated
Message text and escape propertiesv20Content projectionNonedeprecated
Password maxLength propertyv20maxlength propertyNonedeprecated
TreeSelect containerStyle/containerStyleClass propertiesv20style and classNonedeprecated
Table responsiveLayout propertyv20Always defaults to scroll, stack mode needs custom implementationNonedeprecated
TreeSelect default templatev20value templateNonedeprecated
pBadge directivev20OverlayBadge componentNonedeprecated
clearFilterIcon template of Tablev20Obsolete, not utilized.Nonedeprecated

The list of items that were deprecated in previous releases and removed in this iteration.

APIDeprecated SinceReplacementStatus in v20
Calendarv18DatePickerremoved
Dropdownv18Selectremoved
InputSwitchv18ToggleSwitchremoved
OverlayPanelv18Popoverremoved
Sidebarv18Drawerremoved
Chipsv18AutoComplete in multiple mode without typehead optionremoved
TabMenuv18Tabs without panelsremoved
Stepsv18Stepper without panelsremoved
Messagesv18Messageremoved
InlineMessagev18Messageremoved
TabViewv18Tabsremoved
Accordion activeIndex propertyv18value propertyremoved
Accordion headerAriaLevel propertyv18AccordionHeader aria-level attributeremoved
AccordionTabv18AccordionPanel, AccordionHeader, AccordionContentremoved
AutoComplete field propertyv18optionLabel propertyremoved
AutoComplete itemSize propertyv18virtualScrollItemSize propertyremoved
pDeferv18Angular deferred viewsremoved
pAutoFocus autofocus propertyv18 Default attribute directive [pAutoFocus]="true|false"removed
Badge size propertyv18badgeSize propertyremoved
DatePicker monthNavigator, yearNavigator, yearRange, locale propertiesv18Obsolete, not utilized.removed
Dialog positionLeft, responsive, breakpoint propertiesv18Obsolete, not utilized.removed
InputMask autoFocus propertyv18autofocus property.removed
MultiSelect checkicon templatev18headercheckboxicon and itemcheckboxicon.removed
MultiSelect/Select baseZIndex, autoZIndex, showTransitionOptions, hideTransitionOptionsv14overlayOptions propertyremoved
Rating onCancel event and cancelIcon templatev18Obsolete, not utilized.removed
MultiSelect defaultLabel propertyv18placeholder property.removed
MultiSelect/Select itemSize propertyv18virtualScrollItemSize propertyremoved
Select autoDisplayFirst propertyv17Set initial value by model insteadremoved
TreeSelect showTransitionOptions, hideTransitionOptionsv14overlayOptions propertyremoved
Panel expandIcon and collapseIcon propertiesv18headericons templateremoved
StyleClass enterClass/leaveClass propertiesv18enterFromClass and leaveFromClass propertiesremoved
Table scrollDirection property14Obsolete, not utilized.removed
Table responsive property14An horizontal scroll is displayed for smaller screensremoved
Table/TreeTable virtualRowHeight propertyv18virtualScrollItemSize propertyremoved
Table autoLayout propertyv18Table always uses autoLayout as implementation requirementremoved
Tree virtualNodeHeight propertyv18virtualScrollItemSize propertyremoved