Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

React JSONSchema Form

No security coverage Under active development 68 sites

This module integrates the React JSON Schema Form library into Drupal, allowing you to generate forms and fields directly from JSON schemas. It provides a flexible way to create dynamic forms with custom validation and UI configurations.

An integration of https://github.com/rjsf-team/react-jsonschema-form into Drupal's Form and Field APIs.

For additional documentation on this module read the docs at https://rjsf.ctrladel.io/

Form API Usage

$form['rjsf_element'] = [
  '#type' => 'rjsf_editor',
  '#server_validation' => TRUE,
  '#live_validation' => TRUE,
  '#schema' => [
    'title' => 'A registration form',
    'description' => 'A simple form example.',
    'type' => 'object',
    'required' => ['firstName', 'lastName'],
    'properties' => [
      'firstName' => [
        'type' => 'string',
        'title' => 'First name',
        'default' => 'Chuck',
      ],
      'lastName' => [
        'type' => 'string',
        'title' => 'Last name',
      ],
      'telephone' => [
        'type' => 'string',
        'title' => 'Telephone',
        'minLength' => 10,
      ],
    ],
  ],
  '#uiSchema' => [
    'firstName' => [
      'ui:autofocus' => TRUE,
      'ui:emptyValue' => '',
      'ui:autocomplete' => 'family-name',
    ],
    'lastName' => [
      'ui:emptyValue' => '',
      'ui:autocomplete' => 'given-name',
    ],
    'age' => [
      'ui:widget' => 'updown',
      'ui:title' => 'Age of person',
      'ui:description' => '(earthian year)',
    ],
    'bio' => [
      'ui:widget' => 'textarea',
    ],
    'password' => [
      'ui:widget' => 'password',
      'ui:help' => 'Hint: Make it strong!',
    ],
    'date' => [
      'ui:widget' => 'alt-datetime',
    ],
    'telephone' => [
      'ui:options' => [
        'inputType' => 'tel',
      ],
    ],
  ],
];

Field API Usage

When using RJSF on an entity the schema and uiSchema json can be pasted directly into the field settings which is then passed to RJSF when the entities form is rendered.

Install instructions

The easiest way to ensure the editor and widgets are available is to use asset-packagist and require the @drupal-rjsf/editor npm package for this module as a composer dependency. To set up your project to use asset-packagist see here. Then run `composer require npm-asset/drupal-rjsf--edtior`

For more details instructions see https://rjsf.ctrladel.io/installation

Ask your assistant about React JSONSchema Form

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
6
Tracked since
Apr 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
1.0.0-alpha40 Pre-release 10 Dec 15, 2023
1.0.0-alpha39 Pre-release 10 Dec 15, 2023
1.0.0-alpha36 Pre-release 10 Dec 6, 2023
1.0.0-alpha31 Pre-release 10 Jul 7, 2023
1.0.0-alpha30 Pre-release 10 Jul 4, 2023
1.0.0-alpha28 Pre-release 9–10 Apr 29, 2023