JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q35211F
  • License ISC

A reusable React form component with API integration

Package Exports

  • ashish-form
  • ashish-form/dist/index.esm.js
  • ashish-form/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ashish-form) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ashish-form

A reusable React form component with built-in API integration capabilities.

Installation

npm install ashish-form

Usage

import Form from 'ashish-form';

const MyComponent = () => {
  const formData = [
    { label: 'Name', name: 'name', type: 'text' },
    { label: 'Email', name: 'email', type: 'email' }
  ];

  return (
    <Form
      FORMDATA={formData}
      PostAPI="/api/submit"
      BtnClassName="bg-blue-500 text-white p-2 rounded"
      onSuccess={(data) => console.log('Success:', data)}
      onError={(error) => console.log('Error:', error)}
    />
  );
};

Props

  • FORMDATA: Array of form field configurations
  • PostAPI: API endpoint for POST requests
  • UPDATEAPI: API endpoint for UPDATE requests
  • DELETEAPI: API endpoint for DELETE requests
  • ClassName: Custom class for form elements
  • BtnClassName: Custom class for buttons
  • labelClassName: Custom class for labels
  • MainDivClass: Custom class for main container
  • onSuccess: Callback function on successful submission
  • onError: Callback function on error
  • initialData: Initial form data object

License

ISC