PrimeFaces

raw JSON →
14.0.0 verified Fri May 01 auth: no javascript

PrimeFaces is a popular open-source UI component library for JavaServer Faces (JSF) with a rich set of over 100 components for enterprise web applications. The npm package 'primefaces' provides TypeScript type definitions for PrimeFaces client-side JavaScript API. Version 14.0.0 is the current stable release as per the given data, but the latest tagged release is 15.0.14. The library has a high release cadence (multiple minor releases per month) and is actively maintained by the PrimeFaces team. Key differentiators include extensive theme support, built-in AJAX, and a large component set. Peer dependencies include hammerjs, component-emitter, keycharm, propagating-hammerjs, and uuid for gesture and event support.

error Cannot find name 'PrimeFaces'. Did you mean the module 'primefaces'?
cause The package does not export PrimeFaces as a named export; it augments the global scope.
fix
Import with side-effect: import 'primefaces'; Then use PrimeFaces as a global.
error Cannot find name 'PF'. Do you need to install type definitions for a test runner?
cause PF is a global function provided by PrimeFaces runtime, not declared in the type definitions unless imported.
fix
Import the primefaces package: import 'primefaces'; This adds global declarations for PF and PrimeFaces.
error TypeError: PrimeFaces.ajax.AjaxRequest is not a function
cause The type definitions are present but the PrimeFaces runtime is not loaded in the browser.
fix
Ensure PrimeFaces JavaScript library is included (e.g., via JSF tag or script tag). The npm types only provide type checking, not the runtime.
error Module 'primefaces' resolves to a type-only module. Imported module requires a default import.
cause The 'primefaces' package has no default export; it's a types-only package.
fix
Use import 'primefaces'; instead of import Something from 'primefaces';.
breaking In PrimeFaces 14+, the type definitions have been restructured. Some component options interfaces have changed.
fix Review type changes in component options interfaces (e.g., DialogOptions, DataTableOptions). Check migration guide.
deprecated The 'update' method on widgets is deprecated in favor of 'refresh'.
fix Replace widget.update() with widget.refresh()
gotcha This package only provides TypeScript type definitions, not the PrimeFaces library itself. You must include the PrimeFaces runtime (JS) separately, typically via a JSF taglib or build.
fix Include primefaces.jar in your Java web app or use a CDN. The npm types are for client-side type checking only.
breaking jQuery dependency upgrade: PrimeFaces 15.0.13 upgraded to jQuery 4.0.0, which may break custom jQuery plugins or older type definitions.
fix Update jQuery types to version compatible with jQuery 4.0.0 (e.g., @types/jquery@4.x). Test custom scripts.
deprecated The 'PrimeFaces.widget.DataTable' 'filter' method signature changed; old signature deprecated.
fix Use the new filter signature: filter(field, value, type) with optional parameters.
gotcha The type definitions rely on global augmentation. If your tsconfig has 'strict: true', you may need to declare global variables like 'PF'.
fix Add a declaration file (e.g., globals.d.ts) with declare const PF: (id: string) => any; or use a triple-slash directive.
breaking PrimeFaces 15.0.11 introduced a breaking change in Datatable/TreeTable column width unit handling with CSS calc() function.
fix Update column width expressions that use calc() to use the new syntax as per migration notes.
npm install primefaces
yarn add primefaces
pnpm add primefaces

Demonstrates importing PrimeFaces types, using the global PF function, accessing PrimeFaces settings, making an AJAX request, and calling a widget method.

// Ensure jQuery type definitions are available
import 'jquery';
import 'primefaces';

// Use PF global function to get a widget instance
const dialog = PF('myDialog');
if (dialog) {
  dialog.show();
}

// Access PrimeFaces settings
PrimeFaces.settings.locale = 'en';

// Use PrimeFaces ajax utility
PrimeFaces.ajax.AjaxRequest({
  url: '/my-endpoint',
  oncomplete: function(xhr, status, args) {
    console.log('AJAX complete');
  }
});

// Use component widget API
declare const myAutoComplete: any; // Assume widget var from view
myAutoComplete.search('query');