Fable.Form.Simple
5.0.1
dotnet add package Fable.Form.Simple --version 5.0.1
NuGet\Install-Package Fable.Form.Simple -Version 5.0.1
<PackageReference Include="Fable.Form.Simple" Version="5.0.1" />
paket add Fable.Form.Simple --version 5.0.1
#r "nuget: Fable.Form.Simple, 5.0.1"
// Install Fable.Form.Simple as a Cake Addin #addin nuget:?package=Fable.Form.Simple&version=5.0.1 // Install Fable.Form.Simple as a Cake Tool #tool nuget:?package=Fable.Form.Simple&version=5.0.1
Fable.Form
Fable.Form allows you to build forms that are:
- Composable: they can be extended and embedded in other forms
- Type safe: makes the most of F# compiler to tie everything together
- Scalable: you don't need a
Msg
for each field neither repeat yourview
code - Terse: your field logic is defined in a single place
- Modular: you can create your own fields and customize how existing fields are rendered
Example
let form : Form.Form<Values, Msg, _> =
let emailField =
Form.textField
{
Parser =
fun value ->
if value.Contains("@") then
Ok value
else
Error "The e-mail address must contain a '@' symbol"
Value =
fun values -> values.Email
Update =
fun newValue values ->
{ values with Email = newValue }
Error =
fun _ -> None
Attributes =
{
Label = "Email"
Placeholder = "some@email.com"
}
}
let passwordField =
Form.passwordField
{
Parser = Ok
Value =
fun values -> values.Password
Update =
fun newValue values ->
{ values with Password = newValue }
Error =
fun _ -> None
Attributes =
{
Label = "Password"
Placeholder = "Your password"
}
}
let onSubmit =
fun email password ->
LogIn (email, password)
Form.succeed onSubmit
|> Form.append emailField
|> Form.append passwordField
Development
This repository use NPM scripts to control the build system here is a list of the main scripts available:
Script | Description |
---|---|
npm run clean |
To use when want to clean all the artifacts |
npm run watch-examples |
To uses when working on the examples project |
npm run watch-tests |
To use when working on the tests suits |
npm run watch-docs |
To use when working on the documentation, hosted on http://localhost:8080 |
npm run publish-docs |
Build a new version of the documentation and publish it to Github Pages |
npm run release |
Build a new version of the packages if needed and release it |
The secret pun
Naming library is super annoying.
To make it easy to discover, in general, you need to choose a simple and clear name. Especially in a "small" ecosystem like Fable. The problem is that these names are rarely fun neither exciting.
But, it is possible to spice thing up for this reason Fable.Form
stands for Fable.Formidable
.
Special thanks to Urs Enzler who came up with this idea
History
In 2018, I created Thoth.Elmish.FormBuilder as an attempt to prevent having one Msg
per field and repeat the same view
code.
At that time, I was not able to find a way to do it in a fully type safe way and use "magic strings" and boxing/unboxing
to work around the type system a bit.
The problem is that the system is pretty rigid and when you are in form logic you can't access the outside world or pass data in it. For example, it is hard to integrate external errors or pass the user session to send request on the server for auto completion, etc.
Fast forward three years later, I discovered the work done by Héctor Ramón in elm ecosystem with hecrj/composable-form. This library aligned perfectly with my original vision I had in 2018. I finally, decided to accept that Thoth.Elmish.FormBuilder should be archived and that I should write a new library which aligned with my original vision and goals.
Fable.Form can be seen has a port of hecrj/composable-form for Fable but adapted with my vision of how a form should work.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Fable.Form (>= 3.0.0)
- FSharp.Core (>= 5.0.2)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Fable.Form.Simple:
Package | Downloads |
---|---|
Fable.Form.Simple.Bulma
React implementation of standard fields using Bulma CSS framework, to be used with Fable.Form.Simple. |
|
Fable.Form.Simple.MaterialUI
This library is a Material UI implementation of Fable.Form.Simple written in F#. |
|
Fable.Form.Simple.Sutil.Bulma
Sutil implementation of standard fields using Bulma CSS framework, to be used with Fable.Form.Simple. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
5.0.1 | 159 | 10/20/2024 |
5.0.0-beta-003 | 146 | 9/9/2024 |
5.0.0-beta-002 | 128 | 9/9/2024 |
5.0.0-beta-001 | 110 | 9/8/2024 |
4.1.0 | 2,060 | 1/3/2024 |
4.0.0 | 529 | 6/23/2023 |
3.1.0 | 4,068 | 7/12/2022 |
3.0.0 | 968 | 3/28/2022 |
2.1.0 | 1,237 | 11/16/2021 |
2.0.0 | 1,128 | 10/15/2021 |
1.1.0 | 1,497 | 6/7/2021 |
1.0.1 | 437 | 5/11/2021 |
1.0.0 | 412 | 5/11/2021 |
### 🐞 Bug Fixes
* Fix package to correctly include sources files ([18251a5](https://github.com/glutinum-org/cli/commit/18251a5286eda8b744d471b5722cc73ced158175))