Install the package#
npm install @primereact/headless
Import a hook#
import { useAutoComplete } from '@primereact/headless/autocomplete';
function MyAutoComplete() {
const { rootProps, inputProps } = useAutoComplete({
suggestions: ['Apple', 'Banana', 'Cherry']
});
return (
<div {...rootProps}>
<input {...inputProps} />
</div>
);
}That's it — the hook handles state, keyboard navigation, focus, and accessibility. You provide the markup and styles.