Thanks to visit codestin.com
Credit goes to github.com

Skip to content

romkor/felte

 
 

Repository files navigation

Felte: A form library for Svelte

Tests Bundle size NPM Version

Felte is a simple to use form library for Svelte. It is based on Svelte stores and Svelte actions for its functionality. No Field or Form components, just plain stores and actions to build your form however you like. You can see it in action in this CodeSandbox demo!

WARNING: Felte's and it's accompanying packages' API is not set in stone yet, so breaking changes may occur between minor versions until it is stable enough to be 1.0.0

Why

I felt that Svelte would allow to create a simple, almost configuration-less way to handle forms. Current libraries (at least that I have found) still make forms feel reliant on a lot of configuration, or custom Field and Form components which make it a little bit harder to customize styles. I wanted a library that would feel as simple as possible to make a form reactive, without relying on custom components, to make styling and handling forms as simple as possible. TypeScript is also a big plus.

In order to accomplish usage as simple as possible, Felte takes advantage of Svelte actions to be able to make a form reactive using only the use directive. Felte also has built-in error reporting capabilities by using reporters such as @felte/reporter-tippy, @felte/reporter-cvapi and @felte/reporter-dom.

Packages

This repository is a mono-repo containing multiple packages located in the packages directory. Maintained using Bolt and Changesets.

This is the core package that contains all the basic functionality you need to handle your forms in Svelte. Felte optionally allows you to use error reporters (see them as plugins) to prevent you from needing to find a way to display your errors on your form manually. For this we provide already some reporter packages contained in this same repo.

A reporter that uses Tippy.js to display your validation messages without needing any extra work.

A reporter that uses the browser's constraint validation API to display your validation messages.

A reporter that displays the error messages in the DOM, either as a single element or a list of elements.

A reporter that uses a Svelte component to pass the validation messages for you to display.

Common utilities that can be used for any felte package.

License

MIT

About

A form library for Svelte

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 85.1%
  • JavaScript 13.6%
  • Svelte 1.2%
  • Shell 0.1%