![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
bpk-component-autosuggest-css
Advanced tools
Backpack autosuggest component.
npm install bpk-component-autosuggest --save-dev
import React, { Component } from 'react';
import BpkLabel from 'bpk-component-label';
import { withRtlSupport } from 'bpk-component-icon';
import FlightIcon from 'bpk-component-icon/lg/flight';
import BpkAutosuggest, { BpkAutosuggestSuggestion } from 'bpk-component-autosuggest';
const BpkFlightIcon = withRtlSupport(FlightIcon);
const offices = [
{
name: 'Barcelona',
code: 'BCN',
country: 'Spain',
},
...
];
const getSuggestions = (value) => {
const inputValue = value.trim().toLowerCase();
const inputLength = inputValue.length;
return inputLength === 0 ? [] : offices.filter(office =>
office.name.toLowerCase().indexOf(inputValue) !== -1,
);
};
const getSuggestionValue = ({ name, code }) => `${name} (${code})`;
const renderSuggestion = suggestion => (
<BpkAutosuggestSuggestion
value={getSuggestionValue(suggestion)}
subHeading={suggestion.country}
tertiaryLabel="Airport"
indent={suggestion.indent}
icon={BpkFlightIcon}
/>
);
class MyComponent extends Component {
constructor() {
super();
this.state = {
value: '',
suggestions: [],
};
}
onChange = (e, { newValue }) => {
this.setState({
value: newValue,
});
}
onSuggestionsFetchRequested = ({ value }) => {
this.setState({
suggestions: getSuggestions(value),
});
}
onSuggestionsClearRequested = () => {
this.setState({
suggestions: [],
});
}
render() {
const { value, suggestions } = this.state;
const inputProps = {
id: 'my-autosuggest',
name: 'my-autosuggest',
placeholder: 'Enter an office name',
value,
onChange: this.onChange,
};
return (
<div>
<BpkLabel htmlFor="my-autosuggest">Office</BpkLabel>
<BpkAutosuggest
suggestions={suggestions}
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
onSuggestionsClearRequested={this.onSuggestionsClearRequested}
getSuggestionValue={getSuggestionValue}
renderSuggestion={renderSuggestion}
inputProps={inputProps}
/>
</div>
);
}
}
BpkAutosuggest:
Please refer to react-autosuggest
's documentation for a full list of props.
Note: The inputProps
object is passed directly to a BpkInput
component, so its prop types apply also.
BpkAutosuggestSuggestion:
Property | PropType | Required | Default Value |
---|---|---|---|
value | string | true | - |
subHeading | string | false | null |
tertiaryLabel | string | false | null |
icon | func | false | null |
indent | bool | false | false |
className | string | false | null |
FAQs
Backpack autosuggest component.
We found that bpk-component-autosuggest-css demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.