npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-formstack

v1.0.0

Published

A React component that renders a minimally-styled Formstack form.

Readme

ReactFormstack

A React component that renders a minimally-styled Formstack form.

The component hierarchy is as follows:

Getting started

  1. npm i will install dependencies.
  2. npm run start will start the dev server and open the dev site at http://localhost:3003.

Importing

The component can be imported via script tag

<script src="https://[host]/react-formstack.js"></script>

or as a UMD module

import ReactFormstack from 'react-formstack'

Usage

For an example of usage, see the dev implementation here

| Prop | PropType | Description | |------|----------|-------------| | className | string | Optional CSS className value to add to the <form> element. The default is null. | | endpoint | string | Optional prop to change the default Formstack API proxy endpoint. The default is 'https://www.msg.com/formstack'. | | id | string.isRequired | Required string indicating the Formstack form ID. | onBeforeLoad | func | Optional callback function to be called before the form configuration data is fetched from the Formstack API. Defaults to null. | | onAfterLoad | func | Optional callback function to be called after the form configuration data has been fetched from the Formstack API. Defaults to null. | | onBeforeSubmit | func | Optional callback function to be called before a form submission is sent. Defaults to null. | | onAfterSubmit | func | Optional callback function to be called after a form has been submitted. Defaults to null. | | onLoadError | func | Optional callback function to be called when an error is encountered when trying to load the form configuration from the Formstack API. Defaults to null. | | onSubmitError | func | Optional callback function to be called when an error is encountered as a result of submitting the form. Defaults to null. | | onResetForm | func | Optional callback function to be called when the user clicks the "Reset" button. Defaults to null. | | onValidationError | func | Optional callback function to be called when the browser detects an invalid value in a field. The callback is passed the error object and the current state. Defaults to null. | | resetButtonText | string | Text to display on the Reset button. Defaults to 'reset'. | | submitButtonText | string | Text to display on the Submit button. Defaults to 'submit'. | | shouldResetOnSubmit | bool | Optional flag to toggle whether the form fields should reset after the form has been submitted. Defaults to false. |

Examples

Minimal

<ReactFormstack id="123456" />

With reset after submission

<ReactFormstack id="123456" shouldResetOnSubmit />

With custom Submit button text

<ReactFormstack id="123456" submitButtonText="Join Waitlist" />

With event callbacks

<ReactFormstack
  id="123456"
  onAfterSubmit={/*code to close the form DOM container*/}
  onSubmitError={error => console.error('This error has occurred:', error)}
  shouldResetOnSubmit
/>

Full example

<ReactFormstack
  className="my-class"
  endpoint="http://www.msg.local/formstack/"
  id="4513364"
  onAfterLoad={data => console.log(data)}
  onAfterSubmit={data => console.log('onAfterSubmit:', data)}
  onBeforeLoad={url => console.log('onBeforeLoad:', url)}
  onBeforeSubmit={data => console.log('onBeforeSubmit:', data)}
  onLoadError={error => console.error('onLoadError:', error)}
  onSubmitError={error => console.error('onSubmitError:', error)}
  onValidationError={(error, state) => console.error('\n[ReactFormstack] onValidationError:', error, '\n state:', state)}
  resetButtonText="Clear Form"
  shouldResetOnSubmit={true}
  submitButtonText="Submit Form"
/>

CSS Styling

The following CSS selectors are available for styling:

  • #fs-form-[FORM ID]
  • .fs-form
    • #fs-fieldset__[FIELD NAME]
    • .fs-fieldset
      • .fs-legend
      • .fs-label
      • .fs-field-wrapper
        • .fs-field__email
        • .fs-field__name
          • .fs-subfield-first
          • .fs-subfield-last
        • .fs-field__number
        • .fs-field__phone
        • .fs-field__radio
        • .fs-field__section
        • .fs-field__select
        • .fs-field__text
        • .fs-field__textarea
    • .fs-button-bar
      • .fs-button__reset
      • .fs-button__submit
    • .fs-fieldset--required