Build a multi-step form with custom components
Create a multi-step contact form that collects user information across separate screens with configurable default values through Builder.
Overview
Multi-step forms improve user experience by breaking form fields into focused sections.
This tutorial creates a contact form with three steps: basic information, message details, and review. Users with sufficient permissions can customize the component using the Visual Editor.
Prerequisites
Before you begin, you need:
- An integrated Page or Section already connected to Builder.
- Basic knowledge of React and TypeScript.
- Familiarity with custom components.
- A React app running locally.
Final product
This tutorial results in a registered with the Builder registry that collects user information through a multi-step form and provides the flexibility of configuring default values through the Builder's Visual Editor:
Step 1: Create the form component
Create a React component that manages form steps and integrates with Builder props.
Create the component file
Create the component file src/components/ContactForm.tsx to handle user input, manages navigation between steps, and displays a review screen before submission:
Step 2: Add component styling
Create the CSS file src/styles/ContactForm.css to provide a clean, professional form layout with proper spacing, hover effects, and responsive design:
This tutorial uses standard CSS to keep things clear and straightforward. You can use Tailwind CSS, CSS modules, or any styling method you prefer.
Step 3: Register the component with Builder
Create the registration file src/components/ContactFormInfo.ts with the following configuration to make your component available in the Visual Editor.
The contactFormInfo object defines how Builder handles your component. The component property references your React component, while name sets the display name in Builder's component library. The inputs array defines configuration options that appear in the Options tab.
Each input configuration creates a field where users can customize the component. The name property becomes a prop passed to your React component, while friendlyName provides a human-readable label in the Options tab. The type property defines the input type, and defaultValue sets the initial value when the component is added to Builder.
Step 4: Add the component to your page
Register your component with a Builder page to make it available in the Visual Editor.
Create the page file src/pages/FormPage.tsx:
The Builder component connects your React app to Builder's Visual Editor. When Builder loads content, it replaces this component with the visual content created in Builder's editor, including any custom components you've registered through the customComponents array.
Update your main component to include the contact page by modifying src/App.tsx:
Step 5: Run the app locally
Before connecting to Builder, verify your component works in your local development environment.
- Make sure your development server is running with
npm run dev. - Open your browser to
http://localhost:5173. - Test the form by filling out fields, navigating between steps, and submitting.
Your form should work correctly in your local environment before connecting to Builder.
Step 6: Connect to Builder
To see the multi-step form in action:
- Replace the placeholder API key in
src/pages/FormPage.tsxwith your Public API key. - Open Content entry to access the Visual Editor.
- Drag your ContactForm component from the Custom Components section to your page.
- Use the Options tab to configure default values when selecting the component.
- Click Publish to make your changes live with the URL defined.
Customize with advanced input types
Once your basic form is working, you can enhance the component configuration options to give content creators more control over appearance and behavior. Builder supports many input types beyond basic strings to create rich configuration interfaces.
Add dropdown selections
Use enum types to provide predefined options that ensure consistency across your site:
This creates a dropdown menu in the Options tab where users can select between light and dark themes. The selected value gets passed to your component as the formTheme prop, allowing you to conditionally apply CSS classes or styling based on the selection.
Add feature toggles
Boolean inputs provide on/off switches for optional features:
This creates a checkbox that content creators can toggle to show or hide the progress indicator. Your component can then conditionally render the step indicator based on this prop.
Add color customization
Color inputs provide visual color pickers for brand consistency:
This creates a color picker that lets users customize the button color to match their brand. The selected color value gets passed to your component, where you can apply it as an inline style or CSS variable.
Improve usability with helper options
Enhance the configuration experience with additional options:
The helperText property provides descriptive text below the input to clarify its purpose, while required marks the field as mandatory.
These examples demonstrate just a few of the available customization options. Builder provides many other input types for custom components, including file uploads, rich text editors, and reference fields.
You can also create dynamic configuration interfaces using ShowIf with registered components to show or hide inputs based on other field values.
What's next
You now have a working multi-step form that content creators can customize through Builder. Consider these next steps:
- Add form validation with error handling.
- Integrate with your API endpoints for form submission.
- Explore child blocks for embedding Builder content within your form.