Aliases & naming

The names in @saastro/forms that look alike but differ, or differ but mean the same — maxLength vs maxLengthValidation, options vs buttonCardOptions, currency vs input-group, submit vs submitActions, and more.

View as Markdown

Aliases & naming

Some names in the API look alike and do different things; others look different and do the same. This page lists each pair and says which is which. Every row was checked against the package source.

You may wonder The answer
.maxLength(n) vs .maxLengthValidation(n) Different. .maxLength is the field’s maxLength prop (a textarea’s HTML limit); .maxLengthValidation adds a validation rule.
html vs content vs .value() on an html field Same job, in this order. The renderer uses html, else content, else value.
.options() vs .buttonCardOptions() Same slot. Both write the field’s options; the second is typed for button-card options.
.itemCount(min, max) vs .minItems(n) / .maxItems(n) Different place. .itemCount writes validation rules; .minItems/.maxItems are repeater props.
currency vs input-group Same renderer. currency is a type name for an input with a prefix or suffix.
range vs slider (type) Same renderer. range is an alias of slider. The range variant is something else.
createShadcnRegistry vs createComponentRegistry Same function. The first is the deprecated old name.
submit vs submitActions Legacy vs current. submit is deprecated and only used when no onSubmit action exists.
Validation presets vs form presets Unrelated. The first are 19 rules you apply to a field; the second are starter forms in the visual builder.

maxLength vs maxLengthValidation

f.type('textarea').maxLength(500); // field prop: the limit the control advertises
f.type('textarea').maxLengthValidation(500, 'Too long'); // validation rule, with an optional message

They are independent: setting one does not set the other. If you want the limit enforced and shown, use both. The JSDoc of .maxLengthValidation says the same: it sets validation rules, not the HTML attribute.

html, content and .value()

An html field reads its markup from html, then content (the name a JSON config uses), then value (what .value() sets). Use .value('<p>…</p>') in the builder and "content" in JSON; if more than one is set, the first in that order wins. The markup is sanitised either way — see JSON vs builder for trustedHtml.

options and buttonCardOptions

Both builder methods store the array in the field’s options. .buttonCardOptions() accepts the richer ButtonCardOption shape that a button-card field uses; for a select, radio or checkbox-group use .options().

itemCount, minItems and maxItems

  • .itemCount(min, max) writes minItems/maxItems into the field’s validation rules, so it applies to any field whose value is an array, such as a checkbox group.
  • .minItems(n) and .maxItems(n) are props of a repeater field.

When a repeater has both, the field props win over the rules.

currency and input-group

Both types go to the same renderer, so they render identically. currency exists as a type name for the money case and its props are prefix, suffix and placeholder; use input-group when you want the general input with an addon.

range and slider

The field type range is an alias of slider: same props, same rendering. Do not confuse it with .sliderVariant('range'), which gives one slider field two thumbs.

createShadcnRegistry and createComponentRegistry

export const createShadcnRegistry = createComponentRegistry;

It is the same function exported under its old name, kept as a deprecated alias. New code should call createComponentRegistry. See Components.

submit and submitActions

config.submit is deprecated. The submit pipeline runs the submitActions that have an onSubmit trigger; only when there are none does it fall back to a custom submit, and only then to the default submit. New forms should use submitActions (Submit & Actions).

Validation presets and form presets

  • Validation presets are the 19 built-in rule sets you apply with .preset('<id>') — see Validation. They live in the package.
  • Form presets are the starter forms the visual builder offers on an empty canvas (contact, newsletter, lead-gen, event-rsvp, quote-request, gdpr-request, data-capture). They belong to the builder app, not to @saastro/forms.