You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@contensis/forms

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contensis/forms

Render Contensis Forms with React

1.0.3
latest
Source
npmnpm
Version published
Weekly downloads
180
-32.33%
Maintainers
1
Weekly downloads
 
Created
Source

@contensis/forms

Render Contensis Forms in your React projects.

Installation

Install with your project's preferred package manager

npm install --save @contensis/forms
yarn add --save @contensis/forms

Usage

Render a Contensis Form with React

import React from 'react';
import ReactDOM from 'react-dom/client';
import { ContensisForm } from '@contensis/forms';

// Our React App
const App = () => {
  return (
    <div className="content">
      <ContensisForm
        apiUrl="https://api-{yourcms}.cloud.contensis.com"
        projectId="website"
        formId="contactForm" />
    </div>
  );
  // avoid CORS - omit apiUrl prop to make Forms API requests from your root domain (same as Delivery API requests)
};

const element = document.getElementById('root') as HTMLElement;
ReactDOM.createRoot(element).render(
    <React.StrictMode>
        <App />
    </React.StrictMode>
);

Customistion

All customisation options are available in the <ContensisForm> component props.

API

Specify which Form to request from the Forms API

proprequiredcomments
apiUrlThe root url for clients to access the Forms API. Omit this prop if your app will be deployed to Contensis Cloud and you currently use a reverse proxy to make requests to the Delivery API.
formIdYThe API id of the form to render
languageThe language variation of the form to render
projectIdYThe API id of the project containing the form to render
versionStatusRender the 'latest' or 'published' version of the form (default 'published')

Event Handlers

Handle or override specific form data and events

proprequiredcomments
onLoadErrorCalled when there has been a problem loading the form content type
onPopulatePopulate the form with your own custom default values
onSubmitCall your own custom actions when a user has completed the form
onSubmitErrorCalled when there has been a problem submitting a user's completed form
onSubmitSuccessCall your own custom actions when a user has submitted a form successfully

Render States

You can override built-in fallback components to render when the form is in a particular state

proprequiredcomments
disabledComponent to render when the Contensis Form is not enabled render
errorComponent to render when the Contensis Form could not be retrieved from the API
loadingComponent to render when the Contensis Form is loading

Example project

You try this out with the React example project

Keywords

contensis

FAQs

Package last updated on 21 May 2025

Did you know?

Socket

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.

Install

Related posts