npm.io
5.0.1 • Published 1 week ago

@primevue/core

Licence
SEE LICENSE IN LICENSE.md
Version
5.0.1
Deps
3
Size
177 kB
Vulns
0
Weekly
0

PrimeVue Core

Shared infrastructure for PrimeVue components. Every component and editable input in the library depends on this package for base classes, theming, configuration, Pass Through, and forms integration.

Base component hierarchy

Three layered base classes cover the full component spectrum.

BaseComponent handles styling, Pass Through, design token resolution (dt()), and theme loading. No forms awareness.

BaseEditableHolder extends BaseComponent with the forms bridge. Inputs extending this class automatically register with a parent <Form> via provide/inject ($pcForm, $pcFormField) without importing @primevue/forms directly.

BaseInput extends BaseEditableHolder and adds size, fluid, and variant props for form inputs.

Configuration

PrimeVue plugin and usePrimeVue() composable expose global settings (theme preset, locale, PT defaults, ripple) through Vue's provide/inject.

Pass Through (PT)

Lets consumers target any internal element inside a component with custom attributes or classes. Accepts static objects or functions receiving the current component instance.

Styling

useStyle() handles scoped runtime CSS injection and integrates with @primeuix/styled for design token resolution.

Forms bridge

BaseEditableHolder is the contract between any editable input and @primevue/forms. When a component extends it and is placed inside <Form>, registration, value sync, and invalid state all happen automatically.

Usage

// main.ts
import PrimeVue from 'primevue/config';
import Aura from '@primeuix/themes/aura';

app.use(PrimeVue, { theme: { preset: Aura } });
import { usePrimeVue } from '@primevue/core/config';

const primevue = usePrimeVue();
// primevue.config.theme, .locale, .pt, ...

License

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