<Pro6PPInfer />
A styled React component for Pro6PP Infer API. Includes styling, keyboard navigation, and loading states.
Leitet seine ref an HTMLInputElement weiter.
PropsPro6PPInferProps
@pro6pp/infer-coreThe country to perform address lookups in.
Your Pro6PP Authorization Key. Optional if using a proxy.
Number of suggestions to request per batch, at most 1000. 0 uses the default.
- Standard
20
Language code for response labels. Affects the language of returned address labels. Only applicable for BE country code.
Sort mixed address and place suggestions by relevance or distance.
Distance sorting requires the Infer Extended (infer::location) capability. It measures
from lat and lng when provided, otherwise from the approximate location of the request
IP, and sorts by relevance when neither is available.
- Standard
'relevance'
Latitude of the origin used for distance sorting, sent only when sort is 'distance'.
When provided, lng must also be provided.
Longitude of the origin used for distance sorting, sent only when sort is 'distance'.
When provided, lat must also be provided.
Suggestion types to request. Omit this to preserve the address-only default.
If provided, this URL is used as the API endpoint. The query params are appended,
including country in lowercase.
- If not provided, the SDK defaults to 'https://api.pro6pp.nl/v2/infer/{country}'.
The delay in milliseconds before performing the API search. Note: A lower bound of 50ms is enforced to protect API stability.
- Standard
150
Maximum number of retry attempts after a network error or a 5xx or 429 response. Valid range: 0 to 10.
- Standard
0
Callback triggered whenever the internal state (suggestions, loading status, etc.) updates.
Callback triggered when an address selection completes or is cleared.
Receives the AddressValue of the selected address, or its label as a string when the
selection has no structured value. Receives null when the user edits a completed selection
or selects a place after a structured address. Partial selections, such as a city or street,
do not trigger it.
Callback triggered when a point of interest is selected, or with null when the user edits
the selected place or selects an address instead.
@pro6pp/infer-reactInitial address value to pre-fill the state with. Pre-filling does not call onSelect or
onStateChange.
@pro6pp/infer-reactOptional CSS class for the wrapper div.
Optional inline styles for the wrapper div.
Attributes to pass directly to the underlying input element. className is added to
pro6pp-input, onChange, onKeyDown and onFocus run after the component's own handlers,
and value is ignored because the component controls it.
Custom placeholder text.
- Standard
'Start typing an address...'
A custom render function for individual suggestion items.
If true, prevents the default CSS theme from being injected.
- Standard
false
The text to show when no results are found.
- Standard
'No results found'
The text to show on the bottom loading indicator.
- Standard
'Loading more...'
Text displayed while the initial search is pending. Defaults to Searching....
Accessible name for the clear button. Defaults to Clear input.
A custom render function for the "no results" state.
If true, shows a clear button when the input is not empty.
- Standard
true
useInfer
function useInfer(config: UseInferConfig): { state, core, inputProps, selectItem, setValue, setPlace, loadMore }A headless React hook that provides the logic for address search using the Infer API.
| config UseInferConfig | The engine configuration (authKey, country, etc.). |
| Rückgabe | An object containing the current state, the core instance, and pre-bound input props. |
Rückgabe
The current UI state (suggestions, loading status, query, value, etc.).
The raw InferCore instance for manual control.
Pre-configured event handlers to spread onto an <input /> element.
Manually select a specific suggestion.
Programmatically set the address value.
Programmatically set a selected place value.
Load more results.
CSS-Klassen
18 Klassen
| Klasse | Beschreibung |
|---|---|
| .pro6pp-wrapper | The container element wrapping the input and dropdown. |
| .pro6pp-input | The input element itself. |
| .pro6pp-input-addons | The container for the controls inside the input, such as the clear button. |
| .pro6pp-clear-button | The button that clears the input. |
| .pro6pp-dropdown | The panel containing the suggestion list and the loader. |
| .pro6pp-list | The <ul> list containing the suggestions. |
| .pro6pp-item | A single suggestion item (<li>). |
| .pro6pp-item--active | The currently highlighted item (for keyboard navigation). |
| .pro6pp-item__label | The main text/label of a suggestion. |
| .pro6pp-item--place | An item for a point of interest rather than an address. |
| .pro6pp-item__label--match | The part of a label that matches the query. |
| .pro6pp-item--fuzzy | An item for a close match rather than an exact one. |
| .pro6pp-item__label--unmatched | The rest of the label. |
| .pro6pp-item__subtitle | The secondary text (e.g., city or result count). |
| .pro6pp-item__chevron | The icon indicating a folder/expandable result. |
| .pro6pp-no-results | The message shown while searching or when no suggestions are found. |
| .pro6pp-loader-item | The element containing the loading spinner and text. |
| .pro6pp-mini-spinner | The spinner icon inside the loader item. |
Ebenfalls exportiert
Re-Export aus @pro6pp/infer-core.
Countries currently supported by the Infer API for place suggestions.
Returns suggestions in the order intended for display and keyboard navigation.
Mixed and place responses provide the ranked order in suggestions.
If that list is empty, fall back to the separate category arrays.
| state InferState |
Returns whether the Infer API supports place suggestions for a country. Country codes are compared case-insensitively after trimming whitespace.
| country string |
Typen
Pro6PPInferPropsinterfaceProps for the Pro6PPInfer component.
Props for the Pro6PPInfer component.
Your Pro6PP Authorization Key. Optional if using a proxy.
The country to perform address lookups in.
If provided, this URL is used as the API endpoint. The query params are appended,
including country in lowercase.
- If not provided, the SDK defaults to 'https://api.pro6pp.nl/v2/infer/{country}'.
Number of suggestions to request per batch, at most 1000. 0 uses the default.
- Standard
20
The delay in milliseconds before performing the API search. Note: A lower bound of 50ms is enforced to protect API stability.
- Standard
150
Maximum number of retry attempts after a network error or a 5xx or 429 response. Valid range: 0 to 10.
- Standard
0
Language code for response labels. Affects the language of returned address labels. Only applicable for BE country code.
Sort mixed address and place suggestions by relevance or distance.
Distance sorting requires the Infer Extended (infer::location) capability. It measures
from lat and lng when provided, otherwise from the approximate location of the request
IP, and sorts by relevance when neither is available.
- Standard
'relevance'
Latitude of the origin used for distance sorting, sent only when sort is 'distance'.
When provided, lng must also be provided.
Longitude of the origin used for distance sorting, sent only when sort is 'distance'.
When provided, lat must also be provided.
Suggestion types to request. Omit this to preserve the address-only default.
Callback triggered whenever the internal state (suggestions, loading status, etc.) updates.
Callback triggered when an address selection completes or is cleared.
Receives the AddressValue of the selected address, or its label as a string when the
selection has no structured value. Receives null when the user edits a completed selection
or selects a place after a structured address. Partial selections, such as a city or street,
do not trigger it.
Callback triggered when a point of interest is selected, or with null when the user edits
the selected place or selects an address instead.
Initial address value to pre-fill the state with. Pre-filling does not call onSelect or
onStateChange.
Optional CSS class for the wrapper div.
Optional inline styles for the wrapper div.
Attributes to pass directly to the underlying input element. className is added to
pro6pp-input, onChange, onKeyDown and onFocus run after the component's own handlers,
and value is ignored because the component controls it.
Custom placeholder text.
- Standard
'Start typing an address...'
A custom render function for individual suggestion items.
If true, prevents the default CSS theme from being injected.
- Standard
false
The text to show when no results are found.
- Standard
'No results found'
The text to show on the bottom loading indicator.
- Standard
'Loading more...'
Text displayed while the initial search is pending. Defaults to Searching....
Accessible name for the clear button. Defaults to Clear input.
A custom render function for the "no results" state.
If true, shows a clear button when the input is not empty.
- Standard
true
UseInferConfiginterfaceExtended configuration for the React hook.
Extended configuration for the React hook.
Your Pro6PP Authorization Key. Optional if using a proxy.
The country to perform address lookups in.
If provided, this URL is used as the API endpoint. The query params are appended,
including country in lowercase.
- If not provided, the SDK defaults to 'https://api.pro6pp.nl/v2/infer/{country}'.
Number of suggestions to request per batch, at most 1000. 0 uses the default.
- Standard
20
The delay in milliseconds before performing the API search. Note: A lower bound of 50ms is enforced to protect API stability.
- Standard
150
Maximum number of retry attempts after a network error or a 5xx or 429 response. Valid range: 0 to 10.
- Standard
0
Language code for response labels. Affects the language of returned address labels. Only applicable for BE country code.
Sort mixed address and place suggestions by relevance or distance.
Distance sorting requires the Infer Extended (infer::location) capability. It measures
from lat and lng when provided, otherwise from the approximate location of the request
IP, and sorts by relevance when neither is available.
- Standard
'relevance'
Latitude of the origin used for distance sorting, sent only when sort is 'distance'.
When provided, lng must also be provided.
Longitude of the origin used for distance sorting, sent only when sort is 'distance'.
When provided, lat must also be provided.
Suggestion types to request. Omit this to preserve the address-only default.
Callback triggered whenever the internal state (suggestions, loading status, etc.) updates.
Callback triggered when an address selection completes or is cleared.
Receives the AddressValue of the selected address, or its label as a string when the
selection has no structured value. Receives null when the user edits a completed selection
or selects a place after a structured address. Partial selections, such as a city or street,
do not trigger it.
Callback triggered when a point of interest is selected, or with null when the user edits
the selected place or selects an address instead.
Initial address value to pre-fill the state with. Pre-filling does not call onSelect or
onStateChange.
AddressSuggestioninterfaceA regular address or partial-address suggestion.
A regular address or partial-address suggestion.
The text to display in the UI (e.g. "Main Street").
Secondary information (e.g. city name when suggesting a street).
Number of underlying results found for this suggestion.
False for close (fuzzy) matches that top up the exact matches.
The lowercase name the fuzzy pass matched, for close matches.
0-based query positions that differ from the match, for close matches.
The actual address data, when this result completes an address.
Address suggestions may omit this field, as in existing API responses.
AddressValueinterfaceThe standardized address object returned upon a successful final selection.
The standardized address object returned upon a successful final selection.
The name of the street.
The name of the city/locality.
Latitude of the address location.
Longitude of the address location.
The street number.
The postal code.
The street number addition or suffix.
Allow for extra fields if API expands.
CountryCodetypeSupported ISO 3166-1 alpha-2 country codes.
Supported ISO 3166-1 alpha-2 country codes.
type CountryCode = 'NL'
| 'DE'
| 'BE'
| 'AT'
| 'DK'
| 'CH'
| 'LU'
| 'FR'
| 'ES'
| 'GB'
| 'IT'
| (string & {});FetchertypeCustom fetch implementation, compatible with the Web Fetch API.
Custom fetch implementation, compatible with the Web Fetch API.
Custom fetch implementation, compatible with the Web Fetch API. Useful for Node.js environments or proxying requests.
type Fetcher = (input: RequestInfo
| URL, init?: RequestInit) => Promise<Response>;InferConfiginterfaceConfiguration options for the Infer engine.
Configuration options for the Infer engine.
Your Pro6PP Authorization Key. Optional if using a proxy.
The country to perform address lookups in.
If provided, this URL is used as the API endpoint. The query params are appended,
including country in lowercase.
- If not provided, the SDK defaults to 'https://api.pro6pp.nl/v2/infer/{country}'.
Number of suggestions to request per batch, at most 1000. 0 uses the default.
- Standard
20
The delay in milliseconds before performing the API search. Note: A lower bound of 50ms is enforced to protect API stability.
- Standard
150
Maximum number of retry attempts after a network error or a 5xx or 429 response. Valid range: 0 to 10.
- Standard
0
Language code for response labels. Affects the language of returned address labels. Only applicable for BE country code.
Sort mixed address and place suggestions by relevance or distance.
Distance sorting requires the Infer Extended (infer::location) capability. It measures
from lat and lng when provided, otherwise from the approximate location of the request
IP, and sorts by relevance when neither is available.
- Standard
'relevance'
Latitude of the origin used for distance sorting, sent only when sort is 'distance'.
When provided, lng must also be provided.
Longitude of the origin used for distance sorting, sent only when sort is 'distance'.
When provided, lat must also be provided.
Suggestion types to request. Omit this to preserve the address-only default.
Callback triggered whenever the internal state (suggestions, loading status, etc.) updates.
Callback triggered when an address selection completes or is cleared.
Receives the AddressValue of the selected address, or its label as a string when the
selection has no structured value. Receives null when the user edits a completed selection
or selects a place after a structured address. Partial selections, such as a city or street,
do not trigger it.
Callback triggered when a point of interest is selected, or with null when the user edits
the selected place or selects an address instead.
InferPlacesCountryCodetype
type InferPlacesCountryCode = (typeof INFER_PLACES_COUNTRIES)[number];InferResulttypeA single item in the suggestion list.
A single item in the suggestion list.
type InferResult = AddressSuggestion
| PlaceSuggestion;InferStateinterfaceThe complete UI state managed by InferCore.
The complete UI state managed by InferCore.
The current text value of the search input.
The current logical stage of the address lookup.
List of city suggestions (used in mixed stage).
List of street suggestions (used in mixed stage).
General list of suggestions for the current stage.
Place suggestions: the separate places list of the API response, or otherwise the
place suggestions in suggestions.
Flag indicating if the current selection is complete and valid.
The selected address value, otherwise null (places use selectedPlace).
The selected place object, otherwise null.
Flag indicating if the last API request failed.
Flag indicating if a network request is currently in progress.
Flag indicating if more results are available to load.
The index of the currently highlighted suggestion.
0ton: An item is highlighted via keyboard navigation.-1: No item is highlighted.
InferTypestypeThe kinds of suggestions requested from the Infer API.
The kinds of suggestions requested from the Infer API.
The kinds of suggestions requested from the Infer API.
When omitted, the API keeps its address-only default.
type InferTypes = 'address'
| 'place'
| 'address,place';LanguageCodetypeSupported language codes for address labels.
Supported language codes for address labels.
type LanguageCode = 'nl'
| 'fr'
| 'de'
| (string & {});PlaceSuggestioninterfaceA suggestion that represents a point of interest rather than an address.
A suggestion that represents a point of interest rather than an address.
The text to display in the UI (e.g. "Main Street").
Secondary information (e.g. city name when suggesting a street).
Number of underlying results found for this suggestion.
False for close (fuzzy) matches that top up the exact matches.
The lowercase name the fuzzy pass matched, for close matches.
0-based query positions that differ from the match, for close matches.
Marks the suggestion as a point of interest.
The place data.
PlaceValueinterfaceA point of interest returned by the Infer API.
A point of interest returned by the Infer API.
Stable identifier of the place in the source dataset.
Display name of the place.
Primary place category.
Human-readable address, when available.
Street name, when available.
Street number, when available.
Street number addition, when available.
Postal code, when available.
City name, when available.
Latitude of the place.
Longitude of the place.
SortOrdertypeThe ordering applied to mixed address and place suggestions.
The ordering applied to mixed address and place suggestions.
type SortOrder = 'relevance'
| 'distance';StagetypeThe current step in the address inference process.
The current step in the address inference process.
The current step in the address inference process.
empty: No input yet.mixed: User is prompted to choose between cities and streets.place: User is selecting a point of interest.street: User is selecting a street.city: User is selecting a city.postcode: User is entering a postcode.street_number: User is entering a street number.street_number_first: Specialized mode where number is entered before street.addition: Selecting a street number addition (e.g., 'A', 'III').direct: Direct address hit (often via postcode).final: A complete, valid address has been identified.
type Stage = 'empty'
| 'mixed'
| 'place'
| 'street'
| 'city'
| 'postcode'
| 'street_number'
| 'street_number_first'
| 'addition'
| 'direct'
| 'final';