NPM package to get a form component.
CI / CD | Status |
---|---|
NPM | |
Semaphore CI | |
Circle CI | |
Coverall | |
SonarCloud |
form-component
returns a Form component, based on input props. It works on Next
Framework.
npm install @sineverba/form-component
const fieldExample = {
id: "inputId",
type: "select",
label: "Select an option",
name: "fieldName",
onKeyDownRegex: "/^[a-zA-Z0-9]+$/",
initialOption: { value: "initial", label: "Please select" },
options: [
{ value: "value1", label: "Option 1" },
{ value: "value2", label: "Option 2" }
]
};
<FormComponent field={fieldExample} />
Key of field | Permitted values | Required |
---|---|---|
id | "inputId" | Y |
type | "select", "checkbox", "textarea", "text" | Y |
label | "Select an option", "Agree to terms" | N |
name | "fieldName" | Y |
onKeyDownRegex | "/^[a-zA-Z0-9]+$/" | N |
onChange | props.onChange props for checkbox type |
N |
initialOption | { value: "initial", label: "Please select" } | N |
options | [{ value: "value1", label: "Option 1" }, { value: "value2", label: "Option 2" }] |
N |