This project is not covered by Drupal’s security advisory policy.

Overview

Custom Paragraphs is a flexible, lightweight module for Drupal 10/11 that provides a
dynamic repeatable field group system for custom forms.

It allows developers to create reusable, repeatable form components with support for:

  • Dynamic add/remove items
  • Multiple field types (text, textarea, select, file, checkbox)
  • File uploads with preview
  • CKEditor 5 integration
  • Client-side validation
  • JSON-based data storage

Use Case

This module is ideal when building custom forms where users need to input
multiple sets of similar data dynamically.

Examples:

  • Adding multiple addresses
  • Managing team members
  • Uploading multiple documents
  • Creating repeatable content sections

How It Helps in Custom Forms

In standard Drupal form development, handling repeatable fields requires complex form API logic,
AJAX callbacks, and manual state management.

Custom Paragraphs simplifies this by:

  • Providing a ready-to-use JavaScript-powered repeatable UI
  • Reducing backend complexity
  • Handling validation and data collection automatically
  • Supporting file uploads with server-side integration

Developers only need to define field configurations, and the module handles the rest.


Difference Between Paragraph Entity and Custom Paragraphs

Feature Paragraph Entity Custom Paragraphs Module
Purpose Content structuring for entities (nodes, blocks) Dynamic repeatable fields in forms
Storage Stored as entities in database Stored as JSON in form fields
UI Admin-based UI Frontend dynamic UI
Use Case Content modeling Form data collection
Performance Heavier (entity-based) Lightweight (JS-driven)
Flexibility Structured and strict Highly flexible and dynamic

How to Use

1. Attach Library

$form['#attached']['library'][] = 'custom_paragraphs/custom_paragraphs';

2. Add Hidden Field to Store Data

$form['items_data'] = [
  '#type' => 'hidden',
  '#attributes' => ['id' => 'items-data'],
];

3. Add Wrapper Container

$form['items_wrapper'] = [
  '#type' => 'container',
  '#attributes' => [
    'class' => ['rfg-wrapper'],
    'data-rfg-instance' => 'example',
  ],
];

4. Initialize via JavaScript

Use the RepeatableFieldGroup class to define fields and behavior.


Features

  • Unlimited repeatable items
  • Field-level validation
  • File upload with AJAX
  • CKEditor 5 support
  • Prefill existing data
  • Customizable UI and styles

Requirements

  • Drupal 10 or Drupal 11
  • Core Editor module

Documentation

For more details:


Why Use This Module?

If you are building custom forms and need a clean, scalable way to handle repeatable inputs,
Custom Paragraphs provides a modern, developer-friendly solution
without the overhead of entity-based systems.

Supporting organizations: 
AttachmentSize
custom paragraphs img-2.png21.99 KB

Project information

Releases