Using Templates
This guide walks you through how to access, preview, and apply templates to create new forms.
Accessing the Template Galleryโ
The Template Gallery is available in several places:
From the Dashboardโ
- Navigate to Forms section
- Click "Create New Form"
- Select the "Templates" tab
From the Form Builderโ
- Open the Form Builder
- Click "Start from Template" in the empty state
- Browse or search for templates
From This Documentationโ
Browse templates directly in the Template Gallery page, then click "Try on NetPad" to use them.
Browsing Templatesโ
Category Filteringโ
Templates are organized into 14 categories:
- Click a category tab to filter (Business, Healthcare, HR, etc.)
- View templates in that category
- Click "All" to see all templates again
Searchโ
- Type keywords in the search bar
- Results update as you type (fuzzy matching)
- Search matches template names, descriptions, and tags
Complexity Filterโ
Use the complexity dropdown to filter by difficulty:
- Simple โ Basic forms, quick to customize
- Moderate โ Some conditional logic or multiple sections
- Advanced โ Multi-page wizards, complex validation
Previewing Templatesโ
Before using a template, preview it to see what's included:
Template Card Informationโ
Each card shows:
- Icon and Name โ Visual identifier
- Description โ What the template is for
- Complexity Badge โ Simple, Moderate, or Advanced
- Field Count โ Number of fields included
- Estimated Time โ How long to complete the form
Expanded Viewโ
Click a template card to expand it and see:
- Complete field list with types and required indicators
- Configuration code in TypeScript or JSON format
- Copy button for the configuration
- "Try on NetPad" link to use the template
Applying a Templateโ
Method 1: From NetPad Platformโ
- Click "Try on NetPad" on any template
- You'll be taken to netpad.io with the template loaded
- Enter a form name
- Select a target MongoDB collection
- Click "Create Form"
- The Form Builder opens with template fields loaded
Method 2: Using Configuration Codeโ
For programmatic use:
- Click a template card to expand it
- Select TypeScript or JSON format
- Click Copy to copy the configuration
- Use the config in your code:
import { createForm } from '@netpad/forms';
const contactFormConfig = {
name: 'Contact Form',
fields: [
{ type: 'short_text', path: 'firstName', label: 'First Name', required: true },
{ type: 'short_text', path: 'lastName', label: 'Last Name', required: true },
{ type: 'email', path: 'email', label: 'Email Address', required: true },
// ... more fields
],
};
const form = createForm(contactFormConfig);
Method 3: Using @netpad/templates Packageโ
import { getTemplateById } from '@netpad/templates';
// Get the full template configuration
const template = getTemplateById('contact-form');
// Use the config
console.log(template.name); // "Contact Form"
console.log(template.fields); // Array of field configurations
console.log(template.config); // Full form configuration
After Applying a Templateโ
Once a template is applied:
- Review the fields โ Ensure they match your needs
- Customize as needed โ See Customizing Templates
- Configure settings โ Set name, description, thank you message
- Test the form โ Preview and submit test data
- Publish โ Make the form live
Tips for Choosing Templatesโ
| Scenario | Recommendation |
|---|---|
| New to NetPad | Start with a Simple template |
| Exact match exists | Use the template as-is |
| Close match exists | Start with closest template, then customize |
| No good match | Consider building from scratch or using AI |
| Need compliance | Use templates with encryption indicators |
Related Pagesโ
- Template Gallery โ Browse all templates
- Customizing Templates โ Modify templates for your needs
- Form Builder โ Build forms from scratch
- @netpad/templates Package โ Programmatic access