Customizing the Contact Form
Files: src/content/sections/<language>/contact-section.md, src/config/config.toml · Skill level: Beginner
Finzo comes with a built-in contact form that supports popular form handling providers like Formspree, FormSubmit, and Netlify Forms.
You can easily customize the form inputs or change the submission email address without writing JavaScript or server-side code.
In the Tina edition, the fields are under Section defaults, Contact section at /admin/. In the Sanity edition, they are under Sections, Contact section, Form > Inputs in the Studio. In both, the provider settings are under Site settings > Settings.
How to Add a New Form Input
To modify the fields shown in the contact form (like adding a new input), follow the steps below:
Step 1: Locate the Contact Form Markdown File
The contact form fields are controlled by a Markdown file. There is one for each language, such as:
src/content/sections/english/contact-section.mdStep 2: Edit the Form Inputs in Markdown Frontmatter
Here’s what the form part of the frontmatter looks like:
# Check config.toml file for form action related settingsform: title: "Send us a message" emailSubject: "New form submission from finzo website" # Customized email subject (applicable when anyone submit form, form submission may receive by email depend on provider) submitButton: # Refer to the `sharedButton` schema in `src/sections.schema.ts` for all available configuration options (e.g., enable, label, url, hoverEffect, variant, icon, tag, rel, class, target, etc.) enable: true label: "SEND MESSAGE" # hoverEffect: "" # Optional: text-flip | creative-fill | magnetic | magnetic-text-flip # variant: "" # Optional: fill | outline | text # rel: "" # Optional # target: "" # Optional
# This note will show at the end of form # note: | # Your data is safe with us. We respect your privacy and never share your information. <br /> Read our [Privacy Policy](/privacy-policy/). inputs: - label: "" placeholder: "John *" name: "Full Name" # This is crucial. Its indicate under which name you want to receive this field data required: true halfWidth: true defaultValue: "" - label: "" placeholder: "Doe *" name: "Full Name" # This is crucial. Its indicate under which name you want to receive this field data required: true halfWidth: true defaultValue: "" - label: "" placeholder: "john@ko.eoo *" name: "Email Address" # This is crucial. Its indicate under which name you want to receive this field data required: true type: "email" halfWidth: false defaultValue: "" - label: "" placeholder: "Subject *" name: "Subject" # This is crucial. Its indicate under which name you want to receive this field data required: false halfWidth: true dropdown: type: "" # select | search - default is select search: # if type is search then it will work placeholder: "" items: - label: "General Inquiry" value: "General Inquiry" selected: false - label: "Partnership" value: "Partnership" selected: false - label: "Investment" value: "Investment" selected: false - label: "" placeholder: "Subject With Search *" name: "Subject With Search" # This is crucial. Its indicate under which name you want to receive this field data required: false halfWidth: true dropdown: type: "search" # select | search - default is select search: # if type is search then it will work placeholder: "Subject With Search" items: - label: "General Inquiry" value: "General Inquiry" selected: false - label: "Partnership" value: "Partnership" selected: false - label: "Career" value: "Career" selected: false - label: "Investment" value: "Investment" selected: false - label: "Media Inquiry" value: "Media Inquiry" selected: false - label: "" tag: "textarea" defaultValue: "" rows: "2" # Only work if tag is textarea placeholder: "How can we help you *" name: "Message" # This is crucial. Its indicate under which name you want to receive this field data required: true halfWidth: false - label: "Google Search" # only valid for type="checkbox" & type === "radio" checked: false # only valid for type="checkbox" & type === "radio" name: "User Source" # This is crucial. Its indicate under which name you want to receive this field data required: true groupLabel: "How did you hear about us?" # Radio Inputs Label group: "source" # when you add group then it will omit space between the same group radio input type: "radio" halfWidth: true defaultValue: "" - label: "Social Media" # only valid for type="checkbox" & type === "radio" name: "User Source" # This is crucial. Its indicate under which name you want to receive this field data required: true groupLabel: "" # Radio Inputs Label group: "source" # when you add group then it will omit space between the same group radio input type: "radio" halfWidth: true defaultValue: "" # - label: "Referral" # only valid for type="checkbox" & type === "radio" # name: "User Source" # This is crucial. Its indicate under which name you want to receive this field data # required: true # groupLabel: "" # Radio Inputs Label # group: "source" # when you add group then it will omit space between the same group radio input # type: "radio" # halfWidth: true # defaultValue: "" # - label: "Other" # only valid for type="checkbox" & type === "radio" # name: "User Source" # This is crucial. Its indicate under which name you want to receive this field data # required: true # groupLabel: "" # Radio Inputs Label # group: "source" # when you add group then it will omit space between the same group radio input # type: "radio" # halfWidth: true # defaultValue: "" - label: "I agree to the terms and conditions and [privacy policy](/privacy-policy/)." # only valid for type="checkbox" & type === "radio" id: "privacy-policy" name: "Agreed Privacy" # This is crucial. Its indicate under which name you want to receive this field data value: "Agreed" # Value that will be submit (applicable for type="checkbox" & type === "radio") checked: false # only valid for type="checkbox" & type === "radio" required: true type: "checkbox" halfWidth: false defaultValue: "" - note: success # info | warning | success | deprecated | hint parentClass: "hidden text-sm message success" content: We have received your message! We'll get back to you as soon as possible. - note: deprecated # info | warning | success | deprecated | hint parentClass: "hidden text-sm message error" content: Something went wrong! Please try again later or contact us by email.Step 3: Add a New Input Field
To add a new input field (e.g., for a phone number), add another object under inputs. Here’s how you can add a tel input:
- type: "tel" name: "Phone" label: "" placeholder: "+1 555 010 1234" required: false halfWidth: true- Use any standard input
type, such astext,email,tel, orurl, plusradioandcheckbox. - For a text area, use
tag: "textarea"instead of atype. - For a dropdown, add
dropdownas the Subject input does.
Do this in the file for every language.
Changing the Email for Form Submissions
To change where form submissions are sent, update the config.toml file:
Step 1: Opensrc/config/config.toml
Look for the following settings under [settings]:
# Form action URL for the contact formcontactFormAction = "https://formsubmit.co/your_email@example.com"
# formspree | formsubmit.co | netlify (default is formsubmit.co)contactFormProvider = "formsubmit.co"The form ships with this placeholder, and nothing warns you about it. Set it to your own endpoint before you deploy, because submissions go wherever it points.
Step 2: Update the Email in the Form Action URL
Change the contactFormAction to match the provider you’re using:
▶ For FormSubmit (default)
Update the email in the URL:
contactFormAction = "https://formsubmit.co/your@email.com"contactFormProvider = "formsubmit.co"▶ For Formspree
Use your Formspree endpoint (you’ll get this after creating a form):
contactFormAction = "https://formspree.io/f/yourformid"contactFormProvider = "formspree"▶ For Netlify
If you’re deploying to Netlify and want to use Netlify Forms:
contactFormAction = "/"contactFormProvider = "netlify"Make sure your site is deployed to Netlify. The theme adds the data-netlify attribute to the form for you when this provider is set.
Bonus Tips
- The
requiredandtypevalues set the validation for each input. - The
label,name, andplaceholderfields are fully customizable. - The
nameis the label you receive the value under, so keep it clear.
Do It With AI
Add a [FIELD] input to the contact form. Edit form.inputs in contact-section.md, in the folder forevery language in src/content/sections/, and translate the label and placeholder. Use the sameshape as the existing inputs, and don't change ContactForm.astro. Then run npm run astro-check.