Need help with sveltejs-forms?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

mdauner
161 Stars 13 Forks MIT License 150 Commits 10 Opened issues

Description

Declarative forms for Svelte

Services available

!
?

Need anything else?

Contributors list

sveltejs-forms

npm npm bundle size npm

GitHub Actions Status codecov

Declarative forms for Svelte.

DEMO

Features

  • optional schema-based validation through Yup
  • access to nested properties using paths
  • supports custom components
  • provides
    Input
    ,
    Select
    ,
    Choice
    components to reduce boilerplate

Install

$ npm i sveltejs-forms

or

$ yarn add sveltejs-forms

How to use

With provided
Input
,
Select
,
Choice
helper components

{initialValues} validateOnBlur={false} validateOnChange={false} on:submit={handleSubmit} on:reset={handleReset} let:isSubmitting let:isValid > label="Email Address" value="[email protected]" placeholder="e.g. [email protected]" /> Reset Sign in
The form is valid: {isValid}

With custom component:

Submit

Slot props

| Name | Type | |------|------| | isSubmitting |

boolean
| isValid |
boolean
| setValue(path, value) |
function
| touchField(path) |
function
| validate() |
function
| values |
object
| errors |
object
| touched |
object

Contributions

All contributions are welcome.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.