A UI library that provides React components to manage the fetching and rendering logic for Recommendations powered by Constructor.
View the full component documentation and live examples in Storybook:
Explore Storybook Documentation →
- Overview
- Installation & Quick Start
- Integration Modes
- Customization
- Troubleshooting
- Resources
- Contributing
- License
Constructor Recommendations UI provides React components for rendering personalized product recommendations. It handles state management, data fetching, and rendering logic out of the box.
Key capabilities:
- 🔌 Plug & Play – Ready-to-use React components for recommendations
- ⚡ Automatic Data Fetching – Built-in state management and data fetching
- 🎨 Customizable Styling – Minimal default styles, easy to extend or replace
- 🌐 Framework Agnostic – Use with React or as a vanilla JavaScript bundle
- 🛡 TypeScript Support – Full type safety included out of the box
npm i @constructor-io/constructorio-ui-recommendationsimport CioRecommendations from '@constructor-io/constructorio-ui-recommendations';
import '@constructor-io/constructorio-ui-recommendations/styles.css';
function App() {
return <CioRecommendations apiKey='key_M57QS8SMPdLdLx4x' />;
}import CioRecommendations from '@constructor-io/constructorio-ui-recommendations';
function YourComponent() {
return <CioRecommendations apiKey='key_M57QS8SMPdLdLx4x' />;
}This is a framework agnostic method that can be used in any JavaScript project. The CioRecommendations function provides a simple interface to inject an entire recommendations UI into the provided selector.
In addition to recommendation component props, this function also accepts selector and includeCSS.
import CioRecommendations from '@constructor-io/constructorio-ui-recommendations/constructorio-ui-recommendations-bundled';
CioRecommendations({
selector: '#recommendations-container',
includeCSS: true,
apiKey: 'key_M57QS8SMPdLdLx4x',
});By default, importing React components from this library does not pull any CSS into your project.
If you wish to use starter styles from this library, add an import statement similar to the example import statement below:
import '@constructor-io/constructorio-ui-recommendations/styles.css';- The starter styles can be used as a foundation to build on top of, or as a reference to be replaced completely.
- To opt out of all default styling, simply do not import the
styles.cssstylesheet. - All starter styles in this library are scoped within the
.cio-recommendationsCSS selector. - The starter styles are intended to be extended by layering in your own CSS rules.
- If the starter styles are imported,
CioRecommendationscomponent will take up the full width and height of the parent container.
| Issue | Solution |
|---|---|
| Module not found | Run npm install @constructor-io/constructorio-ui-recommendations |
| Need CommonJS build | Import CommonJS: require('@constructor-io/constructorio-ui-recommendations/cjs') |
Need more help? Open a GitHub issue
- Storybook Documentation - Interactive API reference and examples
- Constructor.io JS Client - Core API client
- Constructor.io Docs - Platform documentation
- Fork the repo & create a new branch.
- Run
npm installto install dependencies. - After making the desired changes, run
npm run test && npm run lintlocally. - Submit a PR for review.
Copyright (c) 2022-present Constructor.io Corporation
