@primereact/core
@primereact/core
Shared infrastructure for PrimeReact: global configuration, theming, locale, Pass Through, the stylesheet runtime and the base component system every PrimeReact component is built on.
The package is installed indirectly, since primereact, @primereact/ui and @primereact/headless all depend on it. It is imported directly for one thing above all: PrimeReactProvider.
Usage
Every PrimeReact mode wraps the application once with PrimeReactProvider. What it takes depends on the mode: a theme preset and a PrimeUI license key for styled components, nothing at all for primitives and headless hooks.
'use client';
import { PrimeReactProvider } from '@primereact/core';
import Aura from '@primeuix/themes/aura';
export function Providers({ children }: { children: React.ReactNode }) {
return (
<PrimeReactProvider theme={{ preset: Aura }} license="PrimeUI-Commercial-Key...">
{children}
</PrimeReactProvider>
);
}
The resolved configuration is readable anywhere below the provider through usePrimeReact, useLocale and useTheme.
Server-side rendering needs a PrimeReactStyleSheet passed to the provider. The installation guides cover the per-framework setup.
Documentation
License
Licensed under the PrimeUI License - Copyright (c) PrimeTek Informatics
