
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
pdl-react-autocomplete
Advanced tools
A react component for the People Data Labs Autocomplete API
This library allows users to search the PDL Autocomplete API for valid Search API query values within a specific field along with the number of available records for each suggestion, receive autocompetion suggestions in a drop down of options, and then select a suggestion to be passed into a callback function.
For example, a user queries the 'company' field with the text of 'goog' as a search term, and the autocomplete component will show a dropdown of options that most closely match this search, such as 'google'. The user either clicks or uses their keyboard to select 'google', and 'google' gets passed as the argument to a callback function has been passed down to this component as a prop.
yarn add pdl-react-autocomplete
or
npm i pdl-react-autocomplete
First, import the component library:
import Autocomplete from 'pdl-react-autocomplete';
Then, use the library like any other React component:
return (
<div className="App">
<Autocomplete
field={'company'}
size={5}
onTermSelected={(term) => console.log('onSelectedTerm', term)}
apiKey={'insertKeyHere'}
/>
</div>
);
The Autocomplete API endpoint is documented here: https://docs.peopledatalabs.com/docs/autocomplete-api
field (required)
The field input parameter specifies which type of field to run autocomplete for. The fields supported by the Autocomplete API map to a subset of the Person Schema fields.
Each field argument value for the Autocomplete API maps to a specific subset of Person Schema fields. To see the exact mappings, visit the Autocomplete API Input Parameters documentation
onTermSelected (required)
API Key (required)
size
Refer to the styles in this css file and override the styling of an existing class by creating a new code block with the same class name, but with the '!important' tag.
.pdl-suggestion {
width: 100%;
padding: .5rem;
justify-content: space-between;
}
/* your styling override */
.pdl-suggestion {
background-color: red !important;
}
This library should be used as an internal tool or as a proof of concept as it fires off requests to the PDL Autocomplete API from the client. This is due to the nature of being a react component and API Keys being all encompassing at PDL. We highly suggest referencing the component's code base for spinning up your own version but accessing the PDL Autocomplete API via a proxy server and not using this in a public production environment.
FAQs
A react component for the People Data Labs Autocomplete API
The npm package pdl-react-autocomplete receives a total of 3 weekly downloads. As such, pdl-react-autocomplete popularity was classified as not popular.
We found that pdl-react-autocomplete demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.