Components

Forms

Form components allow users to enter and edit information. They include text fields, selects, checkboxes, switches, and more.

Apple

Banana

Form components are essential for collecting user input. SaleSync provides a comprehensive set of form controls that integrate seamlessly with @tanstack/react-form for form state management and validation.

All form components follow the design tokens system and support consistent sizing, states, and validation patterns.

Select

Select components are used for collecting user provided information from a list of options.

Basic select

Please select your currency

Checkbox

Checkboxes allow users to select one or more items from a set. They can also be used to turn an option on or off.

Enabled
Disabled
Disabled

Switch

Switches toggle the state of a single setting on or off. They are the preferred way to adjust settings on mobile.

Basic
Enabled
Disabled
Disabled
Sizes
Compact
Enabled
Label position
On
Off

Textarea

Textarea components allow users to enter multi-line text.

Maximum 500 characters

Date picker

Date picker components allow users to select a date from a dropdown calendar. The value is stored as an ISO 8601 string (YYYY-MM-DD).

Only future dates allowed

Calendar

Calendar renders an inline month grid for date selection — use it when the picker should always be visible rather than inside a dropdown. The value is stored as an ISO 8601 string (YYYY-MM-DD).

July 2026
Su
Mo
Tu
We
Th
Fr
Sa
July 2026
Su
Mo
Tu
We
Th
Fr
Sa

Only future dates allowed

July 2026
Su
Mo
Tu
We
Th
Fr
Sa

Form validation

SaleSync form components integrate seamlessly with @tanstack/react-form for form state management and validation.

Please enter a valid email address

Min 8 characters

Why TanStack Form?

  • Type-safe form state with TypeScript
  • Built-in validation with adapters for Zod, Yup, Valibot
  • Async validation support
  • Field-level and form-level validation
  • Excellent performance with fine-grained reactivity

API

Complete reference to all props available to form components.

Shared field props (BaseProps)

Every form field (FormInput, FromSelect, FormInputArea, CheckboxComp, ToggleComp, DatePickerComp, CalendarComp) accepts these props via FormBase.

PropTypeDefaultDescription
labelstringThe label for the field.
requiredbooleanfalseIf true, shows a required marker (*) next to the label.
hintstringHelper text displayed below the field.
errorstringError message. When set, replaces the hint and styles the field as invalid.
disabledbooleanfalseIf true, the field is disabled.
FormInput / FromSelect / FormInputArea
PropTypeDefaultDescription
formTanstackFormThe useForm() instance from @tanstack/react-form.
namestringField name, matching a key in defaultValues.
type'text' | 'email' | 'password' | 'number''text'Input type. FormInput only.
placeholderstringPlaceholder text.
options{ value: string; label: string }[]Selectable options. FromSelect only.
rowsnumber4Number of visible text rows. FormInputArea only.
onChange(value: any) => voidOptional override. Defaults to field.handleChange.
CheckboxComp / ToggleComp
PropTypeDefaultDescription
valuebooleanChecked / on state.
onChange(value: boolean) => voidChange handler.
size'compact' | 'normal''normal'Track/thumb size. ToggleComp only.
onLabel / offLabelstring'Enabled' / 'Disabled'Status text shown next to the switch. ToggleComp only.
labelPosition'start' | 'end''end'Position of the status label. ToggleComp only.
DatePickerComp / CalendarComp
PropTypeDefaultDescription
valuestringSelected date as an ISO 8601 string (YYYY-MM-DD). Pass an empty string for no selection.
onChange(value: string) => voidCalled with the new ISO date string when a day is selected.
onBlur() => voidCalled when the picker loses focus or a date is selected.
placeholderstring'Select date'Placeholder text shown when no date is selected. DatePickerComp only.
minDatestringEarliest selectable date as YYYY-MM-DD. Days before this are disabled.
maxDatestringLatest selectable date as YYYY-MM-DD. Days after this are disabled.
FormDatePicker / FormCalendar

Form-connected wrappers that wire up a useForm() field to the underlying picker automatically. They accept all DatePickerComp / CalendarComp props except value and onChange (handled internally), plus the following:

PropTypeDefaultDescription
formTanstackFormThe useForm() instance from @tanstack/react-form.
namestringField name matching a key in defaultValues.
onChange(value: any) => voidOptional override. Defaults to field.handleChange.
Validation helpers

zodFormValidator(schema) adapts a Zod schema into a TanStack Form validator, mapping issues to field-level error messages. useFieldError(form, path) reads the current error message for a given field path, including nested/array fields, directly from the form store.

Component tokens
// Input tokens (tokens.component.input)
input: {
  sm: { paddingX: '10px', paddingY: '6px', fontSize: '12px', radius: '6px', minHeight: '32px' },
  md: { paddingX: '12px', paddingY: '8px', fontSize: '14px', radius: '8px', minHeight: '40px' },
  lg: { paddingX: '16px', paddingY: '12px', fontSize: '16px', radius: '8px', minHeight: '48px' },
  bg: '#FFFFFF',
  bgDisabled: '#F3F4F6',
  border: '#E5E7EB',
  borderHover: '#D1D5DB',
  borderFocus: '#3C53FF',
  borderError: '#FC3638',
  text: '#111827',
  placeholder: '#9CA3AF',
}