# Contact Form

## Customizing the Contact Form

**Files:** `src/content/sections/<language>/contact-section-two.md`, `src/content/sections/<language>/contact-section.md`, `src/config/config.toml` · **Skill level:** Beginner

In the Tina edition, the form's fields are under **Section defaults** at `/admin/`, and the provider under **Site settings > Settings**. In the Sanity edition, the fields are under **Sections** in the Studio, and the provider under **Site settings > Settings**.

Techbyte includes a built-in contact form with support for [Formspree](https://formspree.io/), [FormSubmit](https://formsubmit.co/), and [Netlify Forms](https://docs.netlify.com/forms/setup/).

You can edit the fields directly in Markdown frontmatter and change the form provider from `src/config/config.toml`.

---

### How to Add a New Form Input

#### Step 1: Locate the Contact Form Markdown File

Techbyte has two contact sections, and each has its own form fields:

| File                                                 | Shows on                                                     |
| ---------------------------------------------------- | ------------------------------------------------------------ |
| `src/content/sections/<language>/contact-section-two.md` | The `/contact/` page                                     |
| `src/content/sections/<language>/contact-section.md` | Above Footer 1 on Home 01, the `/projects/` page, and each service page |

Change the file for every language.

#### Step 2: Edit the Form Fields in Markdown Frontmatter

Techbyte's default contact section includes text inputs, a standard select, a searchable select, a message box, radio buttons, a consent checkbox, and a submit button. It also renders the contact info list, whose items pull live values from `settings.contactInfo` in `config.toml` via `settingFieldName`:

```yaml
---
enable: true
badge: "CONTACT US"
title: "Have Questions? Get in Touch!"
list:
  - icon: "Navigation"
    settingFieldName: "address"
  - icon: "Phone"
    settingFieldName: "phone"
  - icon: "MailCheck"
    settingFieldName: "email"
form:
  emailSubject: "New form submission from Techbyte website"
  submitButton:
    enable: true
    label: "Send Message"
    icon:
      enable: true
      name: "ArrowUpRight"
      position: "right"
  inputs:
    - label: ""
      placeholder: "Full Name *"
      name: "Full Name"
      required: true
      halfWidth: true
    - label: ""
      placeholder: "Email Address *"
      name: "Email Address"
      required: true
      type: "email"
      halfWidth: true
    - label: ""
      placeholder: "Project Type *"
      name: "Project Type"
      halfWidth: true
      dropdown:
        type: "search"
        search:
          placeholder: "Search project type"
        items:
          - label: "Managed Services"
            value: "Managed Services"
          - label: "Security Assessment"
            value: "Security Assessment"
---
```

#### Step 3: Add a New Input Field

To add a new field, append another object under `form.inputs`. Example:

```yaml
- label: ""
  placeholder: "Website URL"
  name: "Website"
  type: "text"
  required: false
  halfWidth: true
```

You can also add:

- `dropdown.type: ""` for a standard select
- `dropdown.type: "search"` for the searchable dropdown UI
- a `textarea` field by setting `tag: "textarea"`

---

### Changing the Email for Form Submissions

Open `src/config/config.toml` and locate:

```toml
[settings]
  contactFormAction = "https://formsubmit.co/your_email@example.com"
  contactFormProvider = "formsubmit.co"
```

#### Provider Examples

##### ▶ For FormSubmit

```toml
[settings]
  contactFormAction = "https://formsubmit.co/your_email@example.com"
  contactFormProvider = "formsubmit.co"
```

##### ▶ For Formspree

```toml
[settings]
  contactFormAction = "https://formspree.io/f/your_form_id"
  contactFormProvider = "formspree"
```

##### ▶ For Netlify

```toml
[settings]
  contactFormAction = "/"
  contactFormProvider = "netlify"
```

Techbyte's form component reads those values in `src/layouts/components/widgets/ContactForm.astro`.

<Aside type="caution">
  The theme ships with a placeholder address. While it is still there, submitting
  the form shows a warning and sends nothing. Replace it with your own endpoint
  before you go live.
</Aside>

#### Bonus Tips

- Keep `name` values meaningful because those are the submitted field keys.
- `required` and `type` use normal HTML validation behavior.
- The map shown on the contact page comes from `settings.contactInfo.mapLink` in `config.toml` (a Google Maps embed URL).

<Aside type="tip">
  If you're using Formspree or FormSubmit, remember to verify the target email
  or endpoint on the provider side before going live.
</Aside>

### Do It With AI
```text
Add a contact form field called "[LABEL]" of type [TEXT / EMAIL / DROPDOWN]. Add it under form.inputs
in src/content/sections/<language>/contact-section-two.md and contact-section.md, for every language,
with the label translated. Keep the same field shape as the existing inputs. Then run
npm run astro-check.
```