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-formUsage
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 configurationsPostAPI: API endpoint for POST requestsUPDATEAPI: API endpoint for UPDATE requestsDELETEAPI: API endpoint for DELETE requestsClassName: Custom class for form elementsBtnClassName: Custom class for buttonslabelClassName: Custom class for labelsMainDivClass: Custom class for main containeronSuccess: Callback function on successful submissiononError: Callback function on errorinitialData: Initial form data object
License
ISC