Written by: Geoffrey Callaghan

create a contact form with Bulma

Create A Contact Form With Bulma

Certainly! Here’s a contact form using Bulma CSS along with FabForm for styling and functionality:

<!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>
    <!-- Bulma CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
    <!-- FabForm -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fabform/dist/css/fabform.min.css">
</head>
<body>

<section class="section">
    <div class="container">
        <div class="columns is-centered">
            <div class="column is-half">
                <form id="contactForm" class="fabform">
                    <div class="field">
                        <label class="label">Name</label>
                        <div class="control">
                            <input id="name" name="name" class="input" type="text" placeholder="Enter your name" required>
                        </div>
                    </div>
                    <div class="field">
                        <label class="label">Email</label>
                        <div class="control">
                            <input id="email" name="email" class="input" type="email" placeholder="Enter your email" required>
                        </div>
                    </div>
                    <div class="field">
                        <label class="label">Message</label>
                        <div class="control">
                            <textarea id="message" name="message" class="textarea" placeholder="Enter your message" rows="5" required></textarea>
                        </div>
                    </div>
                    <div class="field">
                        <div class="control">
                            <button type="submit" class="button is-link">Submit</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>

<!-- 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 Bulma CSS provides the overall styling of the form. Feel free to adjust the styles and structure as needed.