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

@engagebay/engagebay-form-module

v1.0.10

Published

Provide base form components to engagebay

Readme

Form and FormField Documentation

Form Component

Description

The Form component is a wrapper that handles form submission, validation, and state management using the react-hook-form library. It provides context to child components and handles the form's lifecycle, including validation and submission.

Props

  • fieldSchema: FormFieldSchema[]
    An array of objects that define the structure and validation rules of form fields.

  • formData: any
    Default values for the form fields.

  • onError?: (error: any) => void
    (Optional) Callback function invoked on form validation errors.

  • onSubmit: (data: FormData) => void
    Callback function that is triggered on successful form submission.

  • children: (props: { ... }) => React.ReactNode
    Function that renders child components, providing various form methods and state as props. These include submitcb, watch, setValue, getValues, reset, setError, trigger, and unregister.

  • customClass?: string
    (Optional) Custom CSS class for the form element.

Example

<Form
  fieldSchema={fieldSchema}
  formData={defaultValues}
  onSubmit={handleSubmit}
  onError={handleError}
  customClass="custom-form-class"
>
  {({ submitcb, watch, setValue }) => <>{/* Your form fields go here */}</>}
</Form>

FormField Component

Description

The FormField component renders individual form fields based on the configuration provided via fieldConfig. It uses the form context provided by the Form component to handle registration and validation.

Props

  • fieldConfig: FormFieldSchema
    Configuration object that defines the field's properties, such as type, validation, and custom handling functions.

  • onChange?: (data: any) => void
    (Optional) Callback function triggered when the field value changes.

Example

<FormField fieldConfig={yourFieldConfig} onChange={handleFieldChange} />

FormFieldSchema

Description

Defines the structure, behavior, and validation rules for individual form fields.

Properties

  • name: string
    The name of the field, used as a key for form data.

  • required: boolean
    Whether the field is required.

  • formFieldType: FormFieldType
    The type of form field, e.g., INPUT, SELECT, CHECKBOX, etc.

  • label?: string
    (Optional) Label for the form field.

  • placeholder?: string
    (Optional) Placeholder text for the field.

  • helpText?: string
    (Optional) Help text displayed alongside the field.

  • disabled?: boolean
    (Optional) Disables the field if set to true.

  • options?: FieldOptionsSchema[]
    (Optional) Array of options for fields like SELECT or RADIO.

  • onChange?: (data: any) => void
    (Optional) Custom handler for the field's onChange event.

  • customClassNames?: { ... }
    (Optional) Custom CSS classes for different parts of the field.

Example

const fieldSchema: FormFieldSchema = {
  name: "email",
  required: true,
  formFieldType: FormFieldType.INPUT,
  label: "Email",
  placeholder: "Enter your email",
  formFieldPattern: [FormFieldPatternsImpl.EMAIL],
};

Additional Types and Enums

  • FormFieldType
    Enum defining various types of form fields (e.g., INPUT, PASSWORD, SELECT, etc.).

  • FormFieldSubType
    Enum defining subtypes of fields, like TEXT and EMAIL.

  • FieldOptionsSchema
    Structure defining options for fields like SELECT or RADIO. Includes value, label, isDisabled, etc.

  • FormFieldPatternsImpl
    Class providing validation patterns and messages for fields (e.g., REQUIRED, EMAIL, URL).