Composants · Référence
Effect Form
Reusable Effect Form fields, submission state, localized HTTP errors with failure fallbacks, grouping, file inputs, and dirty-navigation blocking.
Dernière mise à jour le 17 octobre 2026
Overview
effect-form provides reusable field components for @lucas-barake/effect-form-react. It includes schema-backed fields, submission errors and state, grouped fields, revert actions, and form-owned dirty-navigation blocking. Built-in English and French labels can be read or overridden with effectFormMessages.
Set the active locale once with KrakstackProvider; pass locale directly only when a component needs an override. Message overrides are keyed by arbitrary locale strings, so additional languages can be supplied with messages={{ es: { ... } }}. Exact locale keys such as es-MX take precedence over base keys such as es; English is the final fallback.
Install
bunx shadcn@latest add @krak-stack/effect-formAvailable Fields
TextFieldandNameField— string inputs, with a standard localized name variantTextAreaField,DescriptionField, andNullableTextAreaField— required and nullable multiline valuesCheckboxField— boolean valuesSelectFieldandFolderField— single string selectionMultiSelectFieldandNullableMultiSelectField— array and nullable array selectionSearchableSelectFieldandSingleSearchableSelectField— virtualized searchable multiple and single selectionKeyValueFieldandNullableKeyValueField— record editorsFileField— clearable nativeFilevalues through the sharedFilePickerImageField— local file and persisted URL image values with previewsRevertButton— restores a string field to its original value
Form Helpers
FieldWrappergroups related fields with a legend and optional locale badgeSubmitButtonobserves dirty, changed-since-submit, and waiting stateSubmitErrorandErrorMessagepresent typed failuresBlockNavigationobserves the form and guards unsaved navigation
Usage
const builder = FormBuilder.empty.addField("name", Schema.String);
const form = FormReact.make(builder, {
fields: { name: TextField },
onSubmit: (_, { decoded }) => save(decoded),
});
<form.Initialize defaultValues={{ name: "" }}>
<form.name label="Name" />
<SubmitError result={submitResult} />
<SubmitButton form={form} />
<BlockNavigation form={form} />
</form.Initialize>