This chapter covers the core features and capabilities of Form Builder.
# Render the built-in demo contact form
python src/form_builder.py --demo
# Render from a JSON definition
python src/form_builder.py --input examples/contact_form.json
# Write output to a file
python src/form_builder.py --input examples/contact_form.json --output form.htmlFollow this guide to get Form Builder up and running in your environment.
{
"action": "/api/contact",
"method": "POST",
"id": "contact-form",
"class": "form",
"csrf": true,
"honeypot": true,
"submitLabel": "Send Message",
"fields": [
{
"name": "email",
"type": "email",
"label": "Email Address",
"placeholder": "you@example.com",
"required": true,
"autocomplete": "email"
}
]
}| Property | Type | Description |
|---|---|---|
name | string | Field name attribute (required) |
type | string | Input type: text, email, select, textarea, etc. |
label | string | Human-readable label (auto-generated if empty) |
placeholder | string | Placeholder text |
required | boolean | Whether the field is required |
minLength | integer | Minimum character length |
maxLength | integer | Maximum character length |
min | number | Minimum numeric value |
max | number | Maximum numeric value |
pattern | string | Regex validation pattern |
options | array | Options for select/radio fields |
default | string | Default value |
help | string | Help text shown below the field |
class | string | Additional CSS class for the wrapper |
ariaLabel | string | Explicit ARIA label override |
autocomplete | string | Autocomplete attribute value |
from form_builder import FormConfig, FormField, FieldType, FieldOption, render_form
config = FormConfig(
action="/api/signup",
submit_label="Create Account",
fields=[
FormField(name="username", required=True, min_length=3, max_length=30),
FormField(name="email", field_type=FieldType.EMAIL, required=True),
FormField(name="password", field_type=FieldType.PASSWORD, required=True,
min_length=8, help_text="At least 8 characters"),
FormField(name="role", field_type=FieldType.SELECT, options=[
FieldOption("dev", "Developer"),
FieldOption("designer", "Designer"),
FieldOption("pm", "Product Manager"),
]),
],
)
html = render_form(config)
print(html)Get the full Form Builder and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.