Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte support #516

Open
LukeHagar opened this issue Nov 9, 2023 · 0 comments
Open

Svelte support #516

LukeHagar opened this issue Nov 9, 2023 · 0 comments

Comments

@LukeHagar
Copy link

<script lang ="ts">
import {createForm} from "@tanstack/svelte-form"

const form = createForm({
    defaultValues: {
        age: 0
    },
    onSubmit(values) {
        alert(JSON.stringify(values))
    }
});

$: Field = form.Field;
</script>

<Field name="age" onChange={val => val < 13 ? "You must be 13 to make an account" : undefined}>
    <svelte:fragment let:field>
        <input value={field.state.value}/>
    </svelte:fragment>
</Field>


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants