Gathering detailed insights and metrics for @avarock/react-form
Gathering detailed insights and metrics for @avarock/react-form
Gathering detailed insights and metrics for @avarock/react-form
Gathering detailed insights and metrics for @avarock/react-form
A customizable React form library with modular input components for building flexible forms.
npm install @avarock/react-form
Typescript
Module System
Node Version
NPM Version
56.4
Supply Chain
92.1
Quality
91.8
Maintenance
100
Vulnerability
100
License
TypeScript (52.64%)
SCSS (36.05%)
JavaScript (11.31%)
Total Downloads
1,256
Last Day
3
Last Week
15
Last Month
278
Last Year
1,256
15 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.4.4
Package Id
@avarock/react-form@1.4.4
Unpacked Size
44.11 kB
Size
10.95 kB
File Count
17
NPM Version
10.7.0
Node Version
20.15.0
Publised On
06 Dec 2024
Cumulative downloads
Total Downloads
Last day
50%
3
Compared to previous day
Last week
25%
15
Compared to previous week
Last month
-71.6%
278
Compared to previous month
Last year
0%
1,256
Compared to previous year
28
A lightweight, customizable React + TypeScript library for building dynamic forms with SCSS-based styling.
Install the package via npm:
1npm i @avarock/react-form
light
and dark
).className
and style
props.Here’s an example of how to use the components:
1import { 2 Form, 3 InputText, 4 InputTextAnimated, 5 InputSelect, 6 InputTextArea, 7 InputCheckBox, 8 InputRadio, 9} from "@avarock/react-form"; 10import "@avarock/react-form/dist/styles.css"; 11 12function App() { 13 function handleSubmit(formState: Record<string, any>) { 14 console.log(formState); 15 } 16 17 return ( 18 <div> 19 <Form 20 style={{ gridTemplateColumns: "1fr 1fr", maxWidth: "40rem" }} 21 onSubmit={handleSubmit} 22 theme="light" 23 HTMLValidate={false} 24 showSubmitBtn={true} 25 > 26 <InputText 27 label="Name" 28 name="name" 29 placeholder="Enter your name" 30 required 31 /> 32 <InputText 33 label="Age" 34 name="age" 35 placeholder="Enter your age" 36 type="number" 37 required 38 /> 39 <InputTextAnimated type="email" label="Email" name="email" required /> 40 <InputTextAnimated 41 type="password" 42 label="Password" 43 name="password" 44 required 45 /> 46 <InputSelect 47 label="City" 48 name="city" 49 options={[ 50 { label: "Jaipur", value: "jaipur" }, 51 { label: "Mumbai", value: "mumbai" }, 52 { label: "Hyderabad", value: "hyderabad" }, 53 ]} 54 initialOptionLabel="Select City" 55 required 56 /> 57 <InputTextArea 58 label="Bio" 59 name="bio" 60 placeholder="Enter your bio" 61 maxLength={80} 62 required 63 /> 64 <InputCheckBox 65 style={{ alignSelf: "end" }} 66 label="Allow Cookies" 67 name="isCookieEnabled" 68 /> 69 <InputRadio 70 name="gender" 71 label="Gender" 72 options={[ 73 { label: "Male", value: "male" }, 74 { label: "Female", value: "female" }, 75 { label: "Other", value: "other" }, 76 ]} 77 required 78 /> 79 </Form> 80 </div> 81 ); 82} 83 84export default App;
1import "@avarock/react-form/dist/styles.css";
className
or style
props to apply custom styles.Form
style
: Inline styles for custom layout.onSubmit(formState: Record<string, any>)
: Callback function triggered on form submission with form data.HTMLValidate
: Enable browser-based validation (true
) or use the library's validation (false
).required
, type="email"
, and type="password"
.showSubmitBtn
: Show/hide the submit button.theme
: Choose between "light"
and "dark"
themes.InputText
name
(required): Register the field in the form.label
(required): Display field label.type
: "text" | "password" | "email" | "number"
. Default: "text"
.togglePasswordVisibility
: Show/hide toggle button for password visibility (if type="password"
).HTMLInputElement
attributes.InputTextAnimated
InputText
with the following differences:
placeholder
prop (uses animation instead).InputSelect
name
(required): Register the field in the form.label
(required): Display field label.options
(required): Array of objects { label: string; value: string }
to generate <option>
elements.initialOptionLabel
: Placeholder for the dropdown (Default: "Select"
). Becomes hidden on user toggle, if required
is set.HTMLSelectElement
attributes.InputTextArea
name
(required): Register the field in the form.label
(required): Display field label.maxLength
: Sets the limit and also displays an overlay showing the number of characters typed.HTMLTextareaElement
attributes.InputCheckBox
<input type="checkbox" />
element.name
(required): Register the field in the form.label
(required): Display field label.HTMLInputElement
attributes, except type
, which is set to "checkbox"
.InputRadio
<input type="radio" />
elements.name
(required): Register the field in the form.label
(required): Display field label.options
(required): Array of objects { label: string; value: string }
to generate radio buttons.HTMLInputElement
attributes, except type
(set to "radio"
) and value
(derived from options
).No vulnerabilities found.
No security vulnerabilities found.