Complete Example
Model
The model defines a comprehensive employment offer structure:- Nested Concepts:
MonetaryAmountandProbationare used withinEmploymentOffer - DateTime Type:
startDatefield for date handling - Optional Field:
probationfield marked asoptional - Structured Data: Salary includes both amount and currency code
Template
The template creates a professional offer letter:- Date Formatting:
{{startDate as "DD MMMM YYYY"}}formats dates - Number Formatting:
{{doubleValue as "0,0"}}adds thousand separators - Clauses:
{{#clause annualSalary}}creates reusable sections - Conditionals:
{{#if probation}}shows section only when probation exists - Nested Access: Access
doubleValueandcurrencyCodefromannualSalaryobject
Data
The data object provides complete offer details:- Each nested object includes its own
$classproperty - DateTime values use ISO 8601 format
- Optional fields can be included or omitted
Generated Output
When rendered with the data above, this template produces:DATE: 01 February 2025 Dear Ishan Gupta, We are pleased to offer you the position of Junior AI Engineer at Tech Innovators Inc.. Your employment with Tech Innovators Inc. will commence on 01 February 2025. Your annual gross salary will be 85,000 USD, payable in accordance with company policies. This offer includes a probation period of 3 months, during which your performance and suitability for the role will be evaluated. We are excited about the opportunity to work with you and look forward to your contribution to the team. Sincerely,
Human Resources
Tech Innovators Inc.
Usage
Complete TypeScript Example
Complete TypeScript Example
Variations
Without Probation Period
Without Probation Period
Simply omit the The probation section will not appear in the output.
probation field from the data:Different Currency and Amount
Different Currency and Amount
Key Concepts Demonstrated
1. Date Formatting
2. Number Formatting
3. Clauses
4. Conditional Sections
5. Nested Object Access
Inside{{#clause annualSalary}}, you can directly access doubleValue and currencyCode properties.
Extending the Sample
You can extend this template by adding:- Benefits section: Add an array of benefits
- Multiple signatories: Add company representative details
- Location information: Add office location
- Reporting structure: Add manager name
- Equity compensation: Add stock options or RSUs
Related Samples
NDA Sample
Another business document example
Customer Order
More complex data structures with lists
Next Steps
- Learn more about date formatting
- Explore conditional logic
- Understand clauses in depth
- Read about optional fields