@ptp-us/power-the-polls-form
TypeScript icon, indicating that this package has built-in type declarations

1.2.50 • Public • Published

https://www.npmjs.com/package/@ptp-us/power-the-polls-form

This is a custom web component that allows our partners to embed the Power the Polls signup form on their own web sites and intranets. Contact info@powerthepolls.org to discuss any partnerships.

America needs poll workers to power our democracy

Power the Polls is working every day to recruit a new generation of poll workers — folks excited to serve their communities, help their neighbors vote, and ensure safe access to the ballot box for years to come.

You can help make sure we have a safe, fair, efficient election for all voters, and potentially get paid to do it!

Visit https://powerthepolls.org to sign-up and learn more.

How to embed the form

How to embed in HTML

Include the latest version of the scripts (use module and non-module to support down to IE11) and then use the <power-the-polls-form> element like any other HTML element:

<html>

<head>
   <script type="module"
      src="https://unpkg.com/@ptp-us/power-the-polls-form/power-the-polls-form/power-the-polls-form.esm.js"></script>
   <script nomodule
      src="https://unpkg.com/@ptp-us/power-the-polls-form/power-the-polls-form/power-the-polls-form.js"></script>
</head>

<body>
   <power-the-polls-form partner-id="your-ptp-partner-id" />
</body>

</html>

How to embed in React

Add to your project:

npm install @ptp-us/power-the-polls-form

In your index.jsx, add the following code to initialize the form element:

import { applyPolyfills, defineCustomElements } from "@ptp-us/power-the-polls-form/loader";

applyPolyfills().then(() => {
   defineCustomElements();
});

// ReactDOM.render( ... )

Include the form in your component:

import "@ptp-us/power-the-polls-form";

// ...

<power-the-polls-form
   partner-id={partnerId}
   custom-form-field-label={customFieldLabel}
/>

Note: in our testing with React, attribute names must be kebab-case and not camelCase

To test in your environment, set customFormFieldLabel to a non-null value and if it doesn't show up in the form, you need to use kebab-case.

How to customize the form

How to customize: Attributes

partner-id

This will allow us to track the source of signups back to you.

<power-the-polls-form
   partner-id="your-ptp-partner-id"
/>

custom-form-field-label

Optional label for an additional <input type="text"> field on the form. If null, no additional field will be displayed.

<power-the-polls-form
   custom-form-field-label="Union name"
/>

How to customize: Styles

The form does add some basic styling, but you can override with your own CSS. The elements in use are: <form>, <input>, <select>, <h3>, <h4>, <p>, <button>, and <a> as well as three relevant classes: a.poll-worker-action, a.poll-worker-action.cta, and a.jurisdiction.

Also of note, button and a.poll-worker-action.cta are styled the same and both set a background-color.

You can use the power-the-polls-form element in CSS, e.g.:

power-the-polls-form button {
  background-color: #f0f;
  color: #fff;
}

power-the-polls-form a.poll-worker-action.cta {
  background-color: #f0f;
  color: #fff;
}

How to customize: Events

You can listen for a submitCompleted or submitError event if desired in order to provide additional feedback to your users.

const form = document.querySelector("power-the-polls-form");

form.addEventListener("submitCompleted", () => {
   console.log("Power the Polls form has been submitted");
});

form.addEventListener("submitError", () => {
   console.log("Power the Polls form has encountered an error")
});

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.1.92-beta.10beta
1.2.50113latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.50113
1.2.498
1.2.480
1.2.470
1.2.461
1.2.450
1.2.440
1.2.430
1.2.420
1.2.410
1.2.40
1.2.390
1.2.380
1.2.370
1.2.360
1.2.350
1.2.340
1.2.330
1.2.320
1.2.310
1.2.30
1.2.290
1.2.280
1.2.270
1.2.260
1.2.250
1.2.240
1.2.230
1.2.220
1.2.20
1.2.10
1.2.00
1.1.990
1.1.980
1.1.970
1.1.960
1.1.950
1.1.940
1.1.930
1.1.92-beta.10
1.1.920
1.1.91-beta.10
1.1.90-beta.10
1.1.910
1.1.900
1.1.890
1.1.880
1.1.870
1.1.860
1.1.850
1.1.840
1.1.820
1.1.800
1.1.790
1.1.770
1.1.760
1.1.750
1.1.730
1.1.660
1.1.650
1.1.640
1.1.620
1.1.560
1.1.550
1.1.540
1.1.440
1.1.40
1.1.390
1.1.380
1.1.371
1.1.360
1.1.350
1.1.35-beta.10
1.1.340
1.1.330
1.1.33-beta.10
1.1.320
1.1.32-beta.20
1.1.32-beta.10
1.1.310
1.1.300
1.1.30-beta.30
1.1.30-beta.20
1.1.30-beta.10
1.1.290
1.1.280
1.1.271
1.1.260
1.1.250
1.1.240
1.1.231
1.1.220
1.1.210
1.1.21-beta.11
1.1.200
1.1.180
1.1.170
1.1.160
1.1.16-beta.10
1.1.150
1.1.140
1.1.130
1.1.13-beta.30
1.1.13-beta.20
1.1.13-beta.10
1.1.120
1.1.12-beta.110
1.1.12-beta.100
1.1.12-beta.90
1.1.11-beta.80
1.1.12-beta.50
1.1.12-beta.40
1.1.12-beta.30
1.1.12-beta.20
1.1.11-beta.70
1.1.11-beta.60
1.1.11-beta.50
1.1.11-beta.40
1.1.110
1.1.11-beta.30
1.1.12-beta.10
1.1.11-beta.20
1.1.11-beta.10
1.1.100
1.1.9-beta.40
1.1.80
1.1.9-beta.30
1.1.9-beta.10
1.1.8-beta.20
1.1.8-beta.10
1.1.70
1.1.5-beta.60
1.1.6-beta.50
1.1.6-beta.40
1.1.6-beta.20
1.1.5-beta.50
1.1.5-beta.40
1.1.6-beta.10
1.1.5-beta.30
1.1.5-beta.20
1.1.5-beta.10
1.1.30
1.1.2-beta.20
1.1.2-beta.10
1.1.10
1.1.00
1.1.0-beta.50
1.1.0-beta.40
1.1.0-beta.30
1.1.0-beta.20
1.1.0-beta.10
1.0.80
1.0.8-beta.40
1.0.8-beta.30
1.0.8-beta.20
1.0.8-beta.10
1.0.70
1.0.7-beta.10
1.0.6-beta.30
1.0.6-beta.20
1.0.6-beta.10
1.0.60
1.0.50
1.0.40
1.0.4-beta.10
1.0.30
1.0.20
1.0.2-beta.10
1.0.10
1.0.00
1.0.0-beta.20
1.0.0-beta.11
0.15.10
0.15.00
0.15.0-beta.10
0.14.4-beta.10
0.14.30
0.14.20
0.14.2-beta.10
0.14.10
0.14.1-beta.10
0.14.00
0.13.00
0.13.0-beta.20
0.13.0-beta.10
0.12.10
0.12.00
0.12.0-beta.10
0.11.40
0.11.4-beta.31
0.11.4-beta.20
0.11.4-beta.10
0.11.30
0.11.20
0.11.1-beta.20
0.11.1-beta.10
0.11.00
0.11.0-beta.20
0.11.0-beta.10
0.10.21
0.10.10
0.10.00
0.9.30
0.9.20
0.9.10
0.9.00

Package Sidebar

Install

npm i @ptp-us/power-the-polls-form

Weekly Downloads

129

Version

1.2.50

License

MIT

Unpacked Size

16.8 MB

Total Files

249

Last publish

Collaborators

  • crwallace
  • svouse
  • power-the-polls