Flexible Forms simplifies Statamic form management for you and your users. It offers a drag-and-drop form builder and a user-friendly interface as well as a pre-built form builder partial to speed up your form development.
Features
- Create custom drag-and-drop forms directly in the control panel
- Manage Statamic forms without editing blueprints
- Streamlined forms navigation and user interface
- A prebuilt form template that you can drop straight into your project
Flexible Forms integrates seamlessly with existing Statamic forms.
Installation
Run the following command from your Statamic project root:
composer require addonfoundry/flexible-forms
If you also want to install the form builder partial you will beed to publish it, run the following command after installing Flexible Forms:
php artisan vendor:publish --tag=flexible-forms-partial
Form Builder Partial
To get your forms up and running fast Flexible Forms comes with an installable pre-built form partial that handles all the available form field types, field width and more for you automatically.
Run the following command to publish the form partial, it will be published to resources/views/partials/_form-builder.antlers.html
in your project.
php artisan vendor:publish --tag=flexible-forms-partial
Update the form handle in the partial and then include the partial in your template.
{{ form handle="your_form_handle" }}
...
{{ partial:partials/form-builder }}
Note: you will also need to run npm install
and npm run build
(assuming you are using Vite) to build the TailwindCSS assets for the form partial.
How to Use
Once installed Flexible Forms will be available in the control panel.
This addon leverages Statamic's underlying form functionality so any existing forms will already be available in Flexible Forms. Any forms created in Flexible Forms are also available in your site blueprints and Statamic forms.
Click on a form to use the drag and drop form builder, use the sub-navigation to jump to submissions or form settings for your form.
The form field settings available in the form builder are intentionally simplified to make managing forms easier for non-developers and users. Form blueprints can still be edited under blueprints if required for more customization.
Permissions
Flexible Forms comes with its own permissions. To allow users to only use Flexible Forms rather than Statamic forms you can enable the Flexible Forms permissions for their role while disabling the default Statamic forms permissions.
Configuration
You can exclude form fields from all flexible forms by uncommenting the fields that you want to hide under config/flexible_forms.php
.
<?php
return [
/**
* Fields to exclude from all Flexible Forms
* Note: this won't remove fields already added to a form
*/
'exclude_fields' => [
// 'text',
// 'textarea',
// 'select',
// 'checkboxes',
// 'radio',
'toggle',
'integer',
// 'assets',
// 'spacer',
],
];
License
You may use Flexible Forms without a license while developing locally but Flexible Forms requires a license to be used on a production site.
Note: Statamic Pro is required to create more than one form.