Contentstack provides several prebuilt custom field templates to get you started instantly instead of writing code. You just need to configure these templates a bit and get started.
Below is a list of some of the popular custom field templates provided by Contentstack:
In order to use a pre-built custom field, log in to your Contentstack account, and perform the following steps:
- Go to your stack, navigate to the “Settings” gear icon, and select Extensions.
- Click on + Add Extensions button at the top-right corner of the page, and select Use prebuilt option. If you have not added any extensions in the stack yet, you can also click on the prebuilt extension link displayed on the page.
- In the Prebuilt Extensions window, select Custom Field from the drop-down options.
- Select any prebuilt template (for example, Color Picker), and click on Add.
- In the configuration page, you will see the following options:
- Title (required): You will see a predefined title. This title can be used when adding the custom field in your content type.
- Field data type (required): Based on the custom field you select, you will see a field data type assigned for your input data.
- Multiple (optional): Select this if your custom field accepts multiple values, and the data type is not JSON. It lets the field save input values in an array.
- Hosting method (required): The hosting method is set to Hosted By Contentstack since it is a custom field hosted on Contentstack.
- Extension Source Code (required): You will find the source code for the custom field. You can make changes to this code as per your requirements.
- Config Parameters (optional): If you have used any config parameters in the source code, provide the value for the parameters here. You can pass raw queries as config parameters in this section as shown below:
Note: Users don't need to add config parameters to the prebuilt custom field extensions. By default the extensions are preconfigured and ready to use.
- Finally, Save this widget.