@primereact/hooks
v11.1.0
Published
Hooks for PrimeReact components.
Readme
@primereact/hooks
General-purpose React hooks: filtering, input masking, hotkeys, local storage, media queries, lifecycle effects and more. These are the utilities PrimeReact is built on, published standalone for use in any React project.
No provider, no theme, no CSS.
npm install @primereact/hooksUsage
Each hook has its own kebab-case subpath. The root entry re-exports all of them.
import { useFilter } from '@primereact/hooks/use-filter';
interface Customer {
id: number;
name: string;
country: string;
}
export function CustomerList({ customers, query }: { customers: Customer[]; query: string }) {
const { filteredData } = useFilter<Customer>({ data: customers, field: 'name', value: query });
return (
<ul>
{filteredData.map((customer) => (
<li key={customer.id}>{customer.name}</li>
))}
</ul>
);
}Anything that touches the DOM is marked 'use client' internally, so server components can import these hooks without extra setup.
Component hooks such as useSelect or useDataTable are not part of this package; they live in @primereact/headless.
Documentation
License
Licensed under the PrimeUI License - Copyright (c) PrimeTek Informatics

