Form
Form - Optimised and fully customisable React component
Form Component: Features and Properties for Effective Form Management in React
The Form component acts as a compact wrapper for an HTML form element, effectively handling context management and propagation to its child components. It accepts all standard HTML form properties and additionally offers the following properties:
Form properties
Props of the native component are also available.
#
|
#
|
#
|
#
|
#
|
Example
import { Form, Input } from 'formfusion';
import './App.css';
const MyForm = () => {
const onSubmit = (data: object) => {
console.log('Form submitted successfully', data);
};
return (
<Form onSubmit={onSubmit} validateOnChange className="form">
<h1>Simple payment form</h1>
<Input
id="credit-card-number"
name="credit-card-number"
type="credit-card-number-space"
label="Credit card number"
placeholder="1234 XXXX XXXX XXXX"
required
/>
<Input
id="ccv"
name="ccv"
type="ccv"
label="CCV"
placeholder="Enter your ccv number"
required
/>
<Input
id="expiry-date"
name="expiry-date"
type="date"
label="Expiry date"
required
/>
<button type="submit">Submit</button>
</Form>
);
};
export default MyForm;