
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@constructor-io/constructorio-ui-autocomplete
Advanced tools
Constructor.io Autocomplete UI library for web applications
This UI Library provides React components that manage fetching and rendering logic for Constructor.io's autosuggest services.
Our storybook docs are the best place to explore the behavior and configuration options for this UI Library.
There are two main methods for consuming this UI Library in a React project:
The CioAutocomplete
component handles state management, data fetching, and rendering logic.
import { CioAutocomplete } from 'constructorio-ui-autocomplete';
function YourComponent() {
return (
<div>
<CioAutocomplete apiKey="key_Gep3oQOu5IMcNh9A" />
</div>
);
The useCioAutocomplete
hook handles state management and data fetching, but leaves rendering logic up to you.
import { useCioAutocomplete } from 'constructorio-ui-autocomplete';
function YourComponent() {
const {
isOpen,
sections,
getFormProps,
getLabelProps,
getInputProps,
getMenuProps,
getItemProps,
autocompleteClassName
} = useCioAutocomplete(args);
return (
<div className={autocompleteClassName}>
<form {...getFormProps()}>
<label {...getLabelProps()} hidden>
Search
</label>
<input {...getInputProps()} />
</form>
<div {...getMenuProps()}>
{isOpen && (
<>
{sections?.map((section) => (
<div key={section.identifier} className={section.identifier}>
<div className='cio-section'>
<div className='cio-sectionName'>
{section?.displayName || section.identifier}
</div>
<div className='cio-items'>
{section?.data?.map((item, index) => (
<div
{...getItemProps({
item,
index,
sectionIdentifier: section.identifier
})}
key={item?.data?.id}>
<div>
{isProduct(item) && (
<img
width='100%'
src={item.data?.image_url}
alt=''
data-testid='cio-img'
/>
)}
<p>{item.value}</p>
</div>
</div>
))}
</div>
</div>
</div>
))}
</>
)}
</div>
</div>
);
}
This library provides some default styles. These default styles can be used as a foundation to build on top of or just as a reference for you to replace completely. All default styles in this library are scoped within the .cio-autocomplete
css selector.
autocompleteClassName
optionautocompleteClassName='cio-autocomplete custom-autocomplete-container'
npm ci # install dependencies for local dev
npm run dev # start a local dev server for Storybook
npm run lint # run linter
npm run compile # generate lib folder for publishing to npm
npm run build-storybook # generate storybook static bundle for deploy with GH Pages
FAQs
Constructor.io Autocomplete UI library for web applications
The npm package @constructor-io/constructorio-ui-autocomplete receives a total of 946 weekly downloads. As such, @constructor-io/constructorio-ui-autocomplete popularity was classified as not popular.
We found that @constructor-io/constructorio-ui-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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.