auto-form-builder
v1.0.3
Published
๐งฑ Vue Auto Form Builder with schema-based generation, themes, validation and localization.
Maintainers
Readme
๐งฑ vue-auto-form-builder
A smart and fully customizable Vue 3 component to auto-generate forms using a simple JSON schema.
Supports RTL, Dark Mode, themes, sections, validation, i18n, and more โ all out of the box โก๏ธ
โจ Features
- ๐ Build forms instantly from a schema
- ๐งโ๐จ Fully customizable styling via
themeConfig - ๐งฉ Supports all common field types: text, number, password, file, switch, checkbox, radio, textarea, select, etc.
- ๐ฆ Section-based grouping (with
sectiontitles) - โ Built-in validation (required, min, max, pattern)
- ๐ Multi-language support (EN / AR auto-detect)
- ๐ Auto dark mode support via
prefers-color-scheme - ๐ Optional
submitUrlto POST form data automatically - ๐งช Works perfectly with Tailwind / Bootstrap
- ๐ก JSON output ready-to-use
- ๐ชถ Lightweight and dependency-free
๐ฆ Installation
npm install auto-form-builder๐ Usage
import { AutoForm } from "auto-form-builder";<AutoForm :schema="formSchema" @submit="handleSubmit" />๐ Schema Example
const formSchema = [
{
section: "ู
ุนููู
ุงุช ุฃุณุงุณูุฉ",
fields: [
{ name: "name", label: "ุงูุงุณู
", type: "text", required: true },
{
name: "email",
label: "ุงูุจุฑูุฏ ุงูุฅููุชุฑููู",
type: "email",
required: true,
},
{
name: "gender",
label: "ุงูุฌูุณ",
type: "radio",
options: ["ุฐูุฑ", "ุฃูุซู"],
},
],
},
{
section: "ุชูุงุตูู ุฅุถุงููุฉ",
fields: [
{ name: "dob", label: "ุชุงุฑูุฎ ุงูู
ููุงุฏ", type: "date" },
{ name: "resume", label: "ุงูุณูุฑุฉ ุงูุฐุงุชูุฉ", type: "file" },
],
},
];๐จ Theme Configuration (optional)
<AutoForm
:schema="formSchema"
:theme-config="{
input: 'bg-gray-100 rounded border p-2',
label: 'text-gray-700 font-semibold',
submitButton: 'bg-blue-600 text-white py-2 px-4 rounded'
}"
/>๐ Project Structure
vue-auto-form-builder/
โโโ src/
โ โโโ components/AutoForm.vue
โ โโโ utils/schemaParser.ts
โโโ package.json
โโโ README.md
โโโ tsconfig.json๐ ๏ธ Build & Publish
npm run build
npm publish