Future Export: The road to v2 #954
Replies: 8 comments 30 replies
|
Awesome. I'm excited to explore those new APIs. It would also be great to have something like |
|
I wonder if this opens up a path to progressively enhancing a form to auto-submit when certain values are changed. Any thoughts? Right now our typical approach is a Headless UI component with an If we could use a standard I gave this a quick try using |
|
Any plans for adding per-field validation, especially async validation? For instance, checking if a username is available while typing out the form. With TanStack Form's async validation), I'm able to show a loader on the field while it's validating (the validator is just a Server Action) and then a checkmark if it's successful (still trying to figure out how to do this part with Conform). But the best part about per-field async validation is that it's super easy to write shared code that sets up entire forms without having to create schemas differently depending on whether or not I'm using async validation. |
|
Is conform define any way how to reduce |
|
Using Will the I went through the new Next.js examples but didn’t see it being used there. I recently built a form in Astro (with React) using the new future React export and had to rely on the current
import { useForm } from "@conform-to/react/future";
import { getInputProps} from "@conform-to/react";
export default function ContactForm() {
const { form, fields } = useForm();
return (
<form {...form.props} action={action}
>
<Input
{...getInputProps(fields.email, { type: "email" })}
placeholder="john.doe@example.com"
/>
</form>
);
} |
|
I like the direction of where you are going with Conform v2. My biggest headache right now is that I can't really use Collapsibles / Accordions from ShadCN / Radix / BaseUI since they are removing the elements from the DOM when hidden. Remix-validated-form has a mode in which it derives the form values from React state instead of the DOM itself. (https://www.rvf-js.io/state-mode) Anything along these lines planned? |
|
Came back here to ask, how to programmatically set an error? import { useForm } from "@conform-to/react/future";
import { coerceFormValue } from "@conform-to/zod/v4/future";
import { useState } from "react";
import { z } from "zod";
const schema = z.object({
sources: z.array(z.url()).min(1, { message: "Add at least one URL" }),
});
export default function SourcesForm() {
const [sources, setSources] = useState<string[]>([]);
const [inputValue, setInputValue] = useState("");
const [inputError, setInputError] = useState<string | null>(null); // <-- Extra state for input validation
const { form, fields } = useForm(coerceFormValue(schema));
const handleAddSource = () => {
// Validate URL before adding to array
const result = z.url().safeParse(inputValue.trim());
if (!result.success) {
setInputError("Please enter a valid URL"); // <-- How to report this via conform?
return;
}
setInputError(null);
setSources((prev) => [...prev, inputValue.trim()]);
setInputValue("");
};
return (
<form {...form.props}>
{/* URL input - NOT part of schema, just for adding to array */}
<div>
<label>Add URL</label>
<input
type="url"
value={inputValue}
onChange={(e) => {
setInputValue(e.target.value);
setInputError(null);
}}
/>
<button type="button" onClick={handleAddSource}>
Add
</button>
{inputError && <div>{inputError}</div>}
</div>
{/* Hidden inputs for actual form submission */}
{sources.map((url, i) => (
<input key={i} type="hidden" name={fields.sources.name} value={url} />
))}
{/* Display added sources */}
<ul>
{sources.map((url, i) => (
<li key={i}>
{url}
<button type="button" onClick={() => setSources((prev) => prev.filter((_, j) => j !== i))}>
Remove
</button>
</li>
))}
</ul>
{/* Schema validation error (e.g., "Add at least one URL") */}
{fields.sources.errors && <div>{fields.sources.errors}</div>}
<button type="submit">Submit</button>
</form>
);
}Is there a way to programmatically set/report a field error client-side in the future API? In my use case, I have a text input that validates URLs before adding them to an array field. The input itself isn't part of the schema - it's just a staging area. Currently I'm using a separate |
|
Hello @edmundhung, thank you for the new features for v2. I have been working with the future API lately, and it is a huge improvement. I was trying the new Here is a reproduction, I take a quick look at the |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
It's been over a year since Conform's first major release and we have learned a lot since then. We have seen where people get stuck, where the API causes confusion, and where the complexity starts to pile up. We want to fix those things — but without making the code more complicated.
Over the past 6 months, we have been exploring a new model. We believe it's simpler, more flexible, and easier to reason about without giving up type safety or progressive enhancement. But instead of rushing to v2, we want to validate these ideas with the community first.
That's what the new
futureexport is for:This is a place for experimental APIs we're ready to share but still refining. They are opt-in, and you can adopt them gradually. As these APIs mature, we'll offer migration guides and eventually promote them as the new defaults in v2. Until then, they might include breaking changes in minor versions. So we recommend locking your version range to patch when using them.
We're planning to roll out the first public release of the future export soon, and we're sharing this early so it's not a surprise when it lands — and to avoid confusion when you see new APIs appear.
First up
The first future API is
useControl— a new hook that helps you integrate custom inputs with Conform. Compared touseInputControl, it offers a more flexible setup with better support for multi select, file inputs and checkbox groups.The first public release of this API is just a few days away. We are sharing this announcement early so you can get an idea of what's coming and let us know what you think.
(Update: released in v1.7.0)
What's coming next
In the coming weeks, you will see:
useFormDatahook to subscribe to form data and compute derived state (Update: released in v1.8.0)useFormhook with more control over form state and metadataparsehelpers with better async validation supportAll of these will be released through the
futureexport and get their own write-up.If you try any of these APIs, we would love to hear how they go — what works, what doesn't, and what could be better. Your feedback will help shape the next major version of Conform.
All reactions