Written by: Geoffrey Callaghan

create a Foundation contact form

Create A Foundation Contact Form

Here is contact form using Foundation CSS along with FabForm:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Contact Form</title>
    <!-- Foundation CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites/dist/css/foundation.min.css">
    <!-- FabForm -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fabform/dist/css/fabform.min.css">
</head>
<body>

<div class="grid-container">
    <div class="grid-x grid-padding-x align-center-middle" style="min-height: 100vh;">
        <div class="cell small-10 medium-6">
            <form id="contactForm" class="fabform">
                <h2>Contact Us</h2>
                <div class="grid-x grid-padding-x">
                    <div class="cell">
                        <label for="name">Name</label>
                        <input type="text" id="name" name="name" required>
                    </div>
                </div>
                <div class="grid-x grid-padding-x">
                    <div class="cell">
                        <label for="email">Email</label>
                        <input type="email" id="email" name="email" required>
                    </div>
                </div>
                <div class="grid-x grid-padding-x">
                    <div class="cell">
                        <label for="message">Message</label>
                        <textarea id="message" name="message" rows="4" required></textarea>
                    </div>
                </div>
                <div class="grid-x grid-padding-x">
                    <div class="cell">
                        <button type="submit" class="button">Submit</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- FabForm -->
<script src="https://cdn.jsdelivr.net/npm/fabform/dist/js/fabform.min.js"></script>
<script>
    // Initialize FabForm
    const form = document.getElementById('contactForm');
    new FabForm(form);
</script>

</body>
</html>

This form includes fields for name, email, and message, along with a submit button. FabForm handles the styling and validation, while Foundation CSS provides the overall styling of the form. Feel free to adjust the styles and structure as needed.