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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@saascore/forms

v0.0.2

Published

Form wrapper around Formik

Readme

reform

This library provides a set of components to be used as building blocks for your form. It is a compilation of common form controls built on top of Formik with semantic HMTL and accessibility in mind while leaving styling up to you.

Usage

const reform = require('reform');

// TODO: DEMONSTRATE API

Components

<Checkbox />

Renders a checkbox with a label.

Props

  • name: string — field name
  • label?: React.ReactNode — checkbox label
  • id?: string — sets id attribute for the checkbox as well as for attribute for the label. Defaults to name prop.
  • labelClassName?: string — sets class name for the label.
  • containerClassName?: string — sets class name for the wrapper <div /> containing the checkbox and the label.

Anything else you pass to <Checkbox /> will be applied to the <input /> element rendered by this component.

<CheckboxGroup />

A container component built on top of Formik's <FieldArray /> to be used to render a group of checkboxes.

Props

<CheckboxGroup /> accepts all props supported by <FieldArray /> component from Formik (e.g. render or component or children etc) as well as the following:

  • label?: React.ReactNode — label for the group
  • className?: string — sets class name for the group root element. NOTE: <CheckboxGroup /> renders a fieldset element for the sake of semantic HTML, which results in some styling caveats; see MDN docs on Fieldset for more details.
  • labelClassName?: string — sets class name for the group label.

Example

import CheckboxGroup, { CheckboxItemSelectAll, CheckboxItem } from '@workpop/helium-reform/lib/CheckboxGroup';

const checkboxOptions = [
  {
    label: 'English',
    value: 'EN'
  },
  {
    label: 'French',
    value: 'FR'
  },
  {
    label: 'German',
    value: 'DE'
  },
];

function DemoCheckboxGroup() {
  const renderGroup = React.useCallback(
    (arrayHelpers: FieldArrayRenderProps) => {
      return (
        <React.Fragment>
          <CheckboxItemSelectAll
            options={checkboxOptions}
            arrayHelpers={arrayHelpers}
            label="Select All"
            name={arrayHelpers.name}
          />

          {checkboxOptions.map(({ value, label }) => {
            return (
              <CheckboxItem
                key={`${arrayHelpers.name}_${value}`}
                name={arrayHelpers.name}
                arrayHelpers={arrayHelpers}
                value={value}
                label={label}
              />
            );
          })}
        </React.Fragment>
      );
    },
    [checkboxOptions]
  );

  return (
    <CheckboxGroup
      name="testGroup"
      label="Languages"
      render={renderGroup}
    />
  );
}

Hooks

You don't have to use <CheckboxItem /> or <CheckboxItemSelectAll /> to render checkboxes inside a <CheckboxGroup />. If you want to implement your own checkbox components, you can use these hooks to get values and methods needed for a checkbox to work:

  • useCheckboxInGroup — provides values to be passed to an <input type="checkbox" /> element.
    function MyCheckbox({
      value,
      arrayHelpers,
    }) {
        const checkbox = useCheckboxInGroup(value, arrayHelpers);
        // same as
        // const { name, value, checked, onChange } = useCheckboxInGroup(optionValue, arrayHelpers);
          
        return (
          <input type="checkbox" {...checkbox} />
        );
    }
  • useSelectAll — provides values to be passed to an <input type="checkbox" /> element which would select/deselect all checkboxes on change.
    function MyCheckboxSelectAll({
      options,
      arrayHelpers,
    }) {
      const checkbox = useSelectAll(options, arrayHelpers);
      
      return (
        <input type="checkbox" value="all" {...checkbox} />
      );
    }

<CheckboxItem />

Unlike <Checkbox /> this component is not to be used on its own; its purpose is to render a checkbox belonging to a <CheckboxGroup />.

Props

  • value: string — what value should the checkbox represent.
  • label: React.ReactNode — checkbox label.
  • arrayHelpers: FieldArrayRenderProps — API for working with the group values. This property is provided by <CheckboxGroup />. See Formik docs for more info on arrayHelpers.
  • labelClassName?: string — sets class name for the checkbox label.
  • containerClassName?: string — sets class name for the wrapper <div /> containing the checkbox and the label.

Anything else you pass to <CheckboxItem /> will be applied to the <input /> element rendered by this component.

<CheckboxItemSelectAll />

Similar to <CheckboxItem /> this component should be used only inside a <CheckboxGroup />. It renders a checkbox which will select or deselect all options in the group.

Props

  • label: React.ReactNode — checkbox label.
  • options: CheckboxOption[] — an array of objects describing each checkbox in the group.
  • arrayHelpers: FieldArrayRenderProps — API for working with the group values. This property is provided by <CheckboxGroup />. See Formik docs for more info on arrayHelpers.
  • labelClassName?: string — sets class name for the checkbox label.
  • containerClassName?: string — sets class name for the wrapper <div /> containing the checkbox and the label.

Anything else you pass to <CheckboxItemSelectAll /> will be applied to the <input /> element rendered by this component.

<Input />

Renders an <input /> with a label.

Props

  • name: string — field name
  • label?: React.ReactNode — input label
  • id?: string — sets id attribute for the input as well as for attribute for the label. Defaults to name prop.
  • labelClassName?: string — sets class name for the label.

Anything else you pass to <Input /> will be applied to the <input /> element rendered by this component.

<Label />

A wrapper component around <label />; generally you won't need it unless you are writing your own form control.

Props

  • children?: React.ReactNode
  • htmlFor: string
  • className?: string

<Radio />

Renders a single radio control. Usually makes sense only if used to build a radio group.

Props

  • name: string — field name
  • value: string — what value should the radio represent.
  • label: React.ReactNode — radio label.
  • id?: string — sets id attribute for the radio as well as for attribute for the label. Defaults to name prop.
  • labelClassName?: string — sets class name for the radio label.
  • containerClassName?: string — sets class name for the wrapper <div /> containing the radio and the label.

Anything else you pass to <Radio /> will be applied to the <input /> element rendered by this component.

<RadioGroup />

Renders a group of radio controls. Each radio option should be defined using this interface:

interface RadioOption {
  label: React.ReactNode; // radio label
  value: string; // radio value
}

Props

  • name: string — field name
  • label?: React.ReactNode — label for the group
  • options: CheckboxOption[] — an array of objects describing each radio.
  • className?: string — sets class name for the group root element. NOTE: <RadioGroup /> renders a fieldset element for the sake of semantic HTML, which results in some styling caveats; see MDN docs on Fieldset for more details.
  • labelClassName?: string — sets class name for the group label.

<Select />

Renders a <select /> element. Each option should be defined using this interface:

interface SelectOption {
  label: string; // option label
  value: string; // option value
}

Props

  • name: string — field name
  • label?: React.ReactNode — checkbox label
  • placeholder?: string — will insert an option which has empty value (value="") and placeholder as its label.
  • id?: string — sets id attribute for the select as well as for attribute for the label. Defaults to name prop.
  • className?: string — sets class name for the <select /> node.
  • labelClassName?: string — sets class name for the label.

<TextArea />

Renders a text area.

Props

  • name: string — field name
  • label: React.ReactNode — text area label.
  • id?: string — sets id attribute for the text area as well as for attribute for the label. Defaults to name prop.
  • labelClassName?: string — sets class name for the text area label.

Anything else you pass to <TextArea /> will be applied to the <textarea /> element rendered by this component.