- Changes input type to "hidden" in hidden form control inputs (#121)
- fix: apply correct
data-fs
attributes to elements (#96)
- Fix: Add missing attributes for SSR (#89)
- Feat: Controlled
SuperForm
usage (#83)
- Fix (#79): Bug with the
options
prop of the<Form.Root />
component (#81)
- New Component:
<Form.Control />
(#75)
- Fix: Returned values (#78)
-
Fix lack of reactivity of
data-fs-error
(#66) -
Fix the typing for tag (#67)
-
Fix: Reactivity (#72)
-
fix: export get-form-schema function in helpers/index.ts (#64)
-
- Add utility function
getFormSchema()
(#62)
- Add utility function
- Add FormValidation to Field.config.schema's type (#52)
-
Add data attributes for styling (#49)
-
Fix handling of refined zod schemas so as not to throw false type errors. (#47)
- Forward for events to
<Form.Root />
component (#38)
- b31af0f: Fix: Set Form Context for
getForm
- 83dcbbd: - Add
getForm
helper- Fix bug which was creating large
.d.ts
files and crashing editors
- Fix bug which was creating large
- 709b7ab: - Add
method="POST"
by default to<Form.Root />
- 48eea47: - add
formStore
to<Form.Root />
slot props
- 4bc5459: Fix: Value typing
- bfa0520: Add
tag
prop toValidation
&Description
- 2a857e1: Fix:
<Form.Root />
slot prop types
- 6c46a7f: export additional types
-
0801f7d: Add the
handlers
object containing the event handler helpers as well as thesetValue
helper function to thegetFormField
return object. -
748f8e8: #### Add a
getFormField
helper functionThe
getFormField
helper function must be called upon component initialization and provides some useful stores, actions, etc. when composing your own forms. For example, if I wanted to create a reusableForm.Label
with conditional styles applied to it depending on the error state of the field, I could do something like this:<!-- CustomLabel.svelte --> <script lang="ts"> import { Form, getFormField } from "formsnap"; const { errors } = getFormField(); </script> <Form.Label class={$errors ? "text-red-500" : "text-gray-800"}> <slot /> </Form.Label>
It returns the following type:
export type FormFieldContext = { name: string; ids: { input: string; description: string; validation: string; }; errors: Writable<string[] | undefined>; value: Writable<unknown>; hasDescription: Writable<boolean>; hasValidation: Writable<boolean>; attrStore: AttrStore; actions: ActionsObject; };
-
8596892: Exposes the following additional values from superforms as slot props via the
<Form.Root/>
component.allErrors
delayed
errors
submitting
tainted
timeout
validate
posted
fields
message
options
formId
restore
capture
constraints
- 69b7e73: initial release