@letar/forms

Form Templates

10 ready-made form templates for rapid development

Overview

Form Templates provide pre-built form schemas with default values for common use cases. Use them as-is or customize with overrides.

Quick Start

import { templates } from '@letar/forms'

<Form.FromTemplate
  template={templates.contactForm}
  onSubmit={handleSubmit}
  submitLabel="Send Message"
/>

Available Templates

TemplateFieldsCategory
loginFormemail, passwordAuth
registerFormname, email, password, confirmPasswordAuth
forgotPasswordFormemailAuth
contactFormname, email, phone, messageFeedback
feedbackFormrating, category, message, emailFeedback
npsFormscore (0-10), reason, emailSurvey
companyRegistrationinn, kpp, ogrn, name, address, bik, accountBusiness
orderFormitems[], customer, address, emailE-commerce
profileFormfirstName, lastName, email, phoneProfile
addressFormcountry, city, street, building, apartment, zipAddress

Customization

<Form.FromTemplate
  template={templates.registerForm}
  override={{
    exclude: ['confirmPassword'],
    fields: { email: { label: 'Work Email' } },
  }}
  onSubmit={handleSubmit}
/>

Headless Usage

Use just the schema and default values without the UI:

const { schema, defaultValues } = templates.contactForm

// Use in your own form
<Form schema={schema} initialValue={defaultValues} onSubmit={fn}>
  {/* Your custom layout */}
</Form>

Custom Templates

Create your own templates using the FormTemplate interface:

import type { FormTemplate } from '@letar/forms'
import { z } from 'zod/v4'

export const myTemplate: FormTemplate = {
  name: 'myTemplate',
  title: 'My Form',
  description: 'Custom form template',
  category: 'feedback',
  schema: z.object({ ... }).strip(),
  defaultValues: { ... },
  renderFields: () => null,
}

Live Example

Try the interactive example on forms-example.letar.best.

On this page