npm.io
11.0.0 • Published 5d ago

@primereact/core

Licence
SEE LICENSE IN LICENSE.md
Version
11.0.0
Deps
7
Size
225 kB
Vulns
0
Weekly
0

PrimeReact Core

Shared infrastructure for PrimeReact components. Every component in the library depends on this package for configuration, theming, Pass Through (PT), and styling.

Configuration

PrimeReactProvider and the usePrimeReact() hook expose global settings (theme, locale, ripple, PT defaults) through React context. Wrap the application once and every component reads from the same config.

Base component system

useBase() and useComponent() are the foundation every PrimeReact component is built on. They handle prop resolution, attribute selection, style injection, and PT application so component authors don't repeat that logic.

Pass Through (PT)

The PT system lets consumers override any internal DOM attribute or class on any element inside a component without forking it. PT values can be objects or functions receiving the current instance and state.

Styling

Dynamic stylesheet loading and useStyle() for injecting scoped CSS at runtime. Integrates with @primeuix/styled for design token resolution.

Utilities

Locale management, license verification, overlay positioning, DnD helpers, and re-exports of common utilities from @primeuix/utils.

Usage

import { PrimeReactProvider } from '@primereact/core';
import Aura from '@primeuix/themes/aura';

export default function App() {
    return <PrimeReactProvider value={{ theme: { preset: Aura } }}>{/* components */}</PrimeReactProvider>;
}
import { usePrimeReact } from '@primereact/core';

const { config, locale } = usePrimeReact();

License

Licensed under the PrimeUI License - Copyright (c) PrimeTek Informatics