Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-mailchimp-email-signup-form

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-mailchimp-email-signup-form

Easily collect email signups using MailChimp.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

react-mailchimp-email-signup-form

Easily collect email signups using MailChimp in your React projects.

NPM Version   NPM Downloads   License   Tweet

View demo

View on npm

View on GitHub

Install

Package Manager

# npm
npm i react-mailchimp-email-signup-form

# yarn
yarn add react-mailchimp-email-signup-form

Browser

Or you can include it through the browser at the bottom of your page, along with the css at the top of the page:

<!--
  Please note if you're using the browser method you're going to want to
  adjust the version number as needed. The number given here is just an
  initial version.
-->

<link
  rel="stylesheet"
  type="text/css"
  href="https://unpkg.com/react-mailchimp-email-signup-form@1.0.0/dist/react-mailchimp-email-signup-form.css"
/>

<script src="https://unpkg.com/react-mailchimp-email-signup-form@1.0.0/dist/index.js"></script>

Use

CSS

// css import for when you want to import the component css into your css
// file/files
@import "/path/to/node_modules/react-mailchimp-email-signup-form.css";
// javascript import for when you're importing the css directly in your
// javascript
import "react-mailchimp-email-signup-form/dist/react-mailchimp-email-signup-form.css";

React

import React from "react";
import ReactMailchimpEmailSignupForm from "react-mailchimp-email-signup-form";

// Here's a usage example when using functional components
export const SignupForm = () => {
  return (
    <ReactMailchimpEmailSignupForm
      elementId="first-email-signup-form"
      url="https://XX.us4.list-manage.com/subscribe/post?u=XXXXXXXXXXXXXX"
      title="Subscribe to the Newsletter"
      subtitle="We take privacy seriously and we'll never spam or sell your information."
    />
  )
};

About

This is just a really simple component that let's you use MailChimp's awesome email signup form but with a little bit more of a modern style. Normally for a component this simple I wouldn't really think to share it, but it ends up being really nice to use in things like Gatsby sites where you really don't want to bring a backend anywhere near your site. It's super easy to use - just follow the steps below to generate the url prop you need to pass to the component.

Go to your MailChimp admin. Click on Create, the Signup Form. Now, choose your audience, and stay on the Embedded form option and click Begin.

On the next screen, you'll see some demos for some embedded forms MailChip is offering. We don't want those - but we do want to url they bring. Go into the form and grab the url from the <form></form> action attribute. For me, this looks something like the following:

https://XXXXX.us4.list-manage.com/subscribe/post?u=XXXXXXXXXXXXXXXXXXXXXXXX&amp;id=XXXXXXXXXX

This may look different in your case.

That's it! Just add an elementId, title, and an optional subtitle and you're off.

Notes

I looked into using the MailChimp API option, but that is not going to work from a purely static-type of site. So, while this does have your users leave the page, it ends up being a great option because you really don't have to do anything with any backend at all.

Props

proptyperequireddefaultpossible valuesdescription
elementIdStringYesA unique string form your element.
urlStringYesThe particular form post url from your MailChimp page.
titleStringYesA title for your signup form.
subtitleStringNoA subtitle for your signup form.

SCSS Structure

.subscribe-container  {
  form {
  }

  &__title {
  }

  &__subtitle {
  }

  &__email {
  }

  &__submit {
    &:hover {
    }
  }
}

Development

# install dependencies
npm install

# serve with hot reload and storybook
npm run storybook

# run the tests
npm run test

# build everything and run tests
npm run build

Other

Go ahead and fork the project! Submit an issue if needed. Have fun!

Thank You

Thank you to MailChimp.

License

MIT

Keywords

FAQs

Package last updated on 31 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc