-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Labels
enhancementNew feature or requestNew feature or request
Description
After examining the available form validation libraries, I come to the conclusion that a custom Form component would be the cleanest way of form validation with SvelteUI.
The TextInput field could integrate the on:blur, on:change, on:input event handlers, the bind:value, and the error message using the context API.
I would recommend schema based validation with Zod. For more advanced use cases, a custom validation function could be specified.
<script>
import { Form, TextInput } from '@svelteuidev/core';
import * as zod from 'zod';
const mySchema = z.object({
username: z.string(),
password: z.string(),
};
</script>
<Form schema={mySchema}>
<TextInput name="username"/>
<TextInput name="password" type="password"/>
</Form>Do you want to contribute this feature and create a pull request
Yes
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
No status