Skip to main content

JSS Forms API

Abstract

Describes Sitecore Forms integration in JSS apps using JSS Forms

Sitecore JavaScript Rendering SDK (JSS) provides the capability to consume and post Sitecore Forms from JSS apps. Sitecore Forms is a form-authoring framework that enables marketers to author their own forms, collect data, and analyze form performance.

JSS Forms is a package that implements framework-agnostic helpers to deal with the Sitecore Forms API (serializing forms to post, anti-forgery).

The package leverages the Forms Service REST API provided by the Sitecore Headless Services module.

The following is a sequence diagram illustrating the browser-Sitecore flow when using Sitecore Forms in JSS applications:

JSS - Forms Service sequence diagram

Installing JSS Forms

To install JSS Forms, use the following:

npm i @sitecore-jss/sitecore-jss-forms

Limitations

There are some limitations to be aware of with Sitecore Forms in JSS.

  • To define and render Sitecore Forms in your JSS application, your JSS application must be connected to Sitecore.

  • JSS Forms does not support Sitecore Robot detection.

Framework-specific form component kits

JSS does not come with any fully-fledged forms implementations for every framework. JSS Forms for React, however, is an example of how to leverage the Forms Service and JSS Forms to create framework-specific form component kits.

Refer to the walkthrough for using a Sitecore Form in React and Next.js applications for how to use JSS Forms for React and use the package as inspiration to create your own form solutions for other frameworks.