<form> Component
The <form>
component serves as a container for form elements, providing form-level functionality like validation, submission handling, and state management. It can automatically generate appropriate form structure, validation, and submission logic based on its contents.
<form>
component serves as a container for form elements, providing form-level functionality like validation, submission handling, and state management. It can automatically generate appropriate form structure, validation, and submission logic based on its contents.🛠Attributes
name
string
Yes
Unique identifier for the form
action
string
No
URL endpoint for form submission
method
string
No
HTTP method (post
, get
)
submitLabel
string
No
Label for auto-generated submit button
validate
boolean
No
Enable automatic validation
autoSubmit
boolean
No
Submit on valid input
resetOnSubmit
boolean
No
Clear form after successful submission
ai-hint
string
No
Natural language description of form purpose
Form State Attributes
These attributes can be used within the form to access form state:
formState
object
Current form values
formErrors
object
Current validation errors
isValid
boolean
Form validation status
isSubmitting
boolean
Submission status
✅ Allowed Content
Form input components
Layout components
Validation messages
Submit/reset buttons
💡 Examples
Basic Form with Validation
Complex Form with State
🧩 AI Interpretation Guidelines
Generate appropriate form element with method and action
Create form state management (React state, Vue data, etc.)
Implement validation logic based on input attributes
Handle form submission and reset
Generate appropriate error handling
Create accessibility attributes
Implement proper form structure and semantics
Last updated