Skip to content

Latest commit

 

History

History
55 lines (46 loc) · 1.36 KB

README.md

File metadata and controls

55 lines (46 loc) · 1.36 KB

react-wp-form

Form rendering intended to be used alongside react-w-gql and WP-GraphQL.

GitHub GitHub last commit

Install

yarn add https://github.com/jonshipman/react-wp-form

Usage

import React, { useState } from "react";
import { LeadForm, Valid, LeadFormGroup } from "react-wp-form";
import { gqlUrl } from "../config";

export const ContactForm = (props) => {
  return (
    <div>
      <LeadForm {...props}>
        <LeadFormGroup
          id="yourName"
          placeholder="Your Name"
          valid={Valid.NotEmptyString}
          error="You must include a name."
        />
        <LeadFormGroup
          id="email"
          placeholder="Your Email"
          type="email"
          valid={Valid.Email}
          error="You must include a email."
          className={`w-50-l fl-l pr2-l`}
        />
        <LeadFormGroup
          id="phone"
          placeholder="Your Phone"
          type="tel"
          error="Invalid phone."
          valid={Valid.Phone}
          className={`w-50-l fl-l pl2-l`}
        />
        <LeadFormGroup id="message" placeholder="Message" type="textarea" />
      </LeadForm>
    </div>
  );
};

License

Apache 2.0 © jonshipman