
Product
Introducing GitHub Actions Scanning Support
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
@contentful/experiences-components-react
Advanced tools
A basic set of components to use with Studio Experiences
Experience Builder is currently in a private alpha and not available publicly. If you are interested in participating in the alpha, please reach out to your Contentful account team.
This folder contains the source code for the default/example components that can be used with Experience Builder. These components can be used as-is to kick start building your experiences, or used as an example for building your own components.
The following components are available:
npm install @contentful/experiences-components-react
By default, the components are unstyled. This allows you to style the components to match your brand and design system. If you want a set of default styles to get started, see below.
Each component has a css class that you can use to add your own styles. The classes are named in the style of cf-{component-name} (ie cf-button).
For example, to style the Button component, you can do the following:
.cf-button {
/* your styles here */
}
All components also support passing in custom class names via the className prop. This allows you to add your own class names to the component, which you can then use to style the component.
We provide a helper function (as a higher-order-component) to make it easier to register your own custom components with Experience Builder. This function helps ensure your component has all the required props and is properly registered with Experience Builder.
import { withExperienceBuilder } from '@/utils/withExperienceBuilder';
import { MyComponent } from './MyComponent';
export const ExperienceBuilderMyComponent = withExperienceBuilder(
// Your component
MyComponent,
// component registration configuration for EB
{
id: 'my-component',
name: 'My Component',
category: 'Custom',
variables: {
label: {
type: 'Text',
defaultValue: 'My Component',
},
},
},
);
By default, the withExperienceBuilder function will not wrap your component in a container. However, it is often useful to have your component wrapped. If the components is wrapped, all the styles generated from Experience Builder will be applied to the wrapping container instead of the component itself. This will make it so the additional styles don't interfere with your component's styles.
To wrap your component, pass in the wrapComponent option:
export const ExperienceBuilderMyComponent = withExperienceBuilder(
// Your component
MyComponent,
// component registration configuration for EB
{ /* EB config */ },
// wrap the component with a container (defaults to false)
{ wrapComponent: true }
);
You can also provide the tag name the container will use (which defaults to 'div'):
{ wrapComponent: true, wrapContainerTag: 'span' }
FAQs
A basic set of components to use with Studio Experiences
The npm package @contentful/experiences-components-react receives a total of 5,564 weekly downloads. As such, @contentful/experiences-components-react popularity was classified as popular.
We found that @contentful/experiences-components-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.

Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.

Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.