# Contact Form

## Customizing the Contact Form

**Files:** `src/content/sections/<language>/contact-section.md`, `src/config/config.toml`, `src/layouts/components/widgets/ContactForm.astro` · **Skill level:** Beginner

Lumio 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

The contact form fields are driven by:

```md
src/content/sections/<language>/contact-section.md
```

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

Lumio’s default contact section already includes text inputs, dropdowns, searchable selects, radio buttons, a checkbox, and success/error messages:

```yaml
---
form:
  emailSubject: "New contact form submission"
  submitButton:
    enable: true
    label: "Send a Message"
  inputs:
    - label: "Full Name"
      placeholder: "Full Name *"
      name: "Full Name"
      required: true
      halfWidth: true
    - label: "Email Address"
      placeholder: "Email Address *"
      name: "Email Address"
      required: true
      type: "email"
      halfWidth: true
    - label: "Subject"
      placeholder: "Subject"
      name: "Subject"
      required: true
      halfWidth: true
      dropdown:
        type: "select"
        items:
          - label: "Web Development"
            value: "Web Development"
    - label: "Message"
      tag: "textarea"
      placeholder: "Ask your question"
      name: "Message"
      required: true
      halfWidth: false
---
```

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

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

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

You can also add:

- `dropdown.type: "select"` for a standard select
- `dropdown.type: "search"` for the searchable dropdown UI
- radio or checkbox fields using `type`, `group`, and `groupLabel`

---

### Changing the Email for Form Submissions

The form ships with this placeholder, so nothing arrives until you set your own. 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"
```

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

#### Bonus Tips

- Keep `name` values meaningful because those are the submitted field keys.
- `required` and `type` use normal HTML validation behavior.
- The success and error messages at the end of the `inputs` array can be customized too.

<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>

### Blog Comment Form

The theme has a blog comment form, but it is switched off in the code, so no page shows it. To show it, open `src/layouts/components/widgets/BlogDetails.astro`, import `BlogCommentSection` from `../sections/BlogCommentSection.astro`, and remove the HTML comment around it near the end of the file. It uses the same `contactFormAction` and `contactFormProvider` as the contact form.