75 lines
1.6 KiB
Markdown
75 lines
1.6 KiB
Markdown
|
|
# Real-World Templates
|
||
|
|
|
||
|
|
Complete, production-ready form templates for common use cases.
|
||
|
|
|
||
|
|
## Available Templates
|
||
|
|
|
||
|
|
### Employee Onboarding
|
||
|
|
|
||
|
|
See: `employee_onboarding/`
|
||
|
|
|
||
|
|
Complete employee onboarding workflow:
|
||
|
|
- Personal information
|
||
|
|
- Employment details
|
||
|
|
- Policy agreements
|
||
|
|
- Emergency contacts
|
||
|
|
- Benefits selection
|
||
|
|
|
||
|
|
### User Registration
|
||
|
|
|
||
|
|
See: `user_registration/`
|
||
|
|
|
||
|
|
User registration and sign-up flow:
|
||
|
|
- Account information
|
||
|
|
- Contact details
|
||
|
|
- Password setup
|
||
|
|
- Email verification
|
||
|
|
- Terms acceptance
|
||
|
|
|
||
|
|
### Library Catalog
|
||
|
|
|
||
|
|
See: `library_catalog/`
|
||
|
|
|
||
|
|
Library management system:
|
||
|
|
- Book information
|
||
|
|
- Author details
|
||
|
|
- Inventory tracking
|
||
|
|
- Checkout system
|
||
|
|
- Lending rules
|
||
|
|
|
||
|
|
## Using These Templates
|
||
|
|
|
||
|
|
### As-is
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Run employee onboarding form
|
||
|
|
cargo run -p typedialog-web -- --config examples/09-templates/employee_onboarding/form.toml
|
||
|
|
|
||
|
|
# Run user registration
|
||
|
|
cargo run -p typedialog-web -- --config examples/09-templates/user_registration/form.toml
|
||
|
|
```
|
||
|
|
|
||
|
|
### As Starting Points
|
||
|
|
|
||
|
|
Copy and customize for your needs:
|
||
|
|
- Modify fields for your domain
|
||
|
|
- Add backend-specific logic
|
||
|
|
- Integrate with your database
|
||
|
|
- Add validation and error handling
|
||
|
|
|
||
|
|
## Template Structure
|
||
|
|
|
||
|
|
Each template includes:
|
||
|
|
- `form.toml` - Form definition
|
||
|
|
- `README.md` - Template documentation
|
||
|
|
- `example.json` - Sample submission data (if applicable)
|
||
|
|
|
||
|
|
## Common Patterns
|
||
|
|
|
||
|
|
All templates demonstrate:
|
||
|
|
- **Validation** - Field-level validation rules
|
||
|
|
- **Sections** - Logical form organization
|
||
|
|
- **Conditional Logic** - Show/hide fields based on input
|
||
|
|
- **Error Handling** - Clear error messages
|
||
|
|
- **Accessibility** - Labels and descriptions
|