Overview
SaaS Starter Vue provides a complete form system with validation support. Forms are built using vee-validate for validation logic and zod for schema definition, integrated with Inertia.js form handling.Form Validation Stack
- vee-validate - Form validation library
- @vee-validate/zod - Zod integration for vee-validate
- zod - TypeScript-first schema validation
- Inertia.js useForm - Server-side validation and form state
Basic Form Example
Here’s a simple login form using Inertia.js form handling:Input Component
TheInput component supports all standard HTML input attributes:
Input Props
modelValue- v-model bindingtype- Input type (text, email, password, etc.)placeholder- Placeholder textdisabled- Disabled stateclass- Additional CSS classes
Input States
Textarea Component
For multi-line text input:Select Component
Dropdown selection using reka-ui:Checkbox Component
For boolean selections:resources/js/pages/system/auth/Login.vue:82-87:
Switch Component
Toggle switches for on/off states:Radio Group
For selecting one option from multiple choices:Form with Client Validation
Using vee-validate with zod schemas:Form with Inertia.js
Combining Inertia.js form handling with components:Label Component
Accessible form labels with proper associations:- Click-to-focus behavior
- ARIA associations
- Disabled state styling
- Screen reader support
Form Structure Components
For organized form layouts:Input Error Display
TheInputError component displays validation errors:
File Upload
Handling file uploads with preview:Best Practices
- Always use labels - Provide accessible labels for all form fields
- Show validation errors - Display clear error messages near the relevant field
- Disable on submit - Prevent double submissions by disabling the submit button
- Reset on success - Clear sensitive fields after successful submission
- Use appropriate input types - email, password, tel, etc. for better UX
- Add autocomplete - Help users fill forms faster
- Provide placeholder text - Give users context about expected input
Accessibility
All form components include:- Proper ARIA attributes
- Keyboard navigation
- Focus indicators
- Error announcements
- Label associations