Fable.Lit.Unofficial 2.19.0

dotnet add package Fable.Lit.Unofficial --version 2.19.0
                    
NuGet\Install-Package Fable.Lit.Unofficial -Version 2.19.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fable.Lit.Unofficial" Version="2.19.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fable.Lit.Unofficial" Version="2.19.0" />
                    
Directory.Packages.props
<PackageReference Include="Fable.Lit.Unofficial" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Fable.Lit.Unofficial --version 2.19.0
                    
#r "nuget: Fable.Lit.Unofficial, 2.19.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Fable.Lit.Unofficial@2.19.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Fable.Lit.Unofficial&version=2.19.0
                    
Install as a Cake Addin
#tool nuget:?package=Fable.Lit.Unofficial&version=2.19.0
                    
Install as a Cake Tool

Fable.Lit.Unofficial

F# bindings for lit.

dotnet add package Fable.Lit.Unofficial

Write templates in F# with an interpolated string, and render them with lit:

open Lit

let view name =
    html $"""<p>Hello {name}, <button @click={Ev(fun _ -> printfn "hi")}>click</button></p>"""

Lit.render (document.getElementById "app") (view "world")

Components come in two shapes. A HookComponent is a function that renders into whoever called it; a LitElement is a real custom element with its own tag, shadow root and styles:

[<LitElement("my-counter")>]
let Counter () =
    LitElement.init (fun config -> config.styles <- [ css $"p {{ margin: 0; }}" ]) |> ignore
    let count, setCount = Hook.useState 0
    html $"""<p>{count}</p><button @click={Ev(fun _ -> setCount (count + 1))}>+</button>"""

Beyond upstream

  • Lit.renderPart returns the root part, so a tree rendered into a plain element can be told it was disconnected (part.setConnected false) instead of running forever.
  • Lit.trackConnection upgrades any dashed tag into a host that reports joining and leaving the document, shaped as an effect: what runs on arrival returns what to undo on departure.
  • Hydrate.adopt takes over server-rendered markup, and renders instead of failing when the markup cannot be adopted — including the refusal lit reports only to the console.
  • config.formAssociated makes a LitElement visible to a form, so attachInternals works and a custom control can contribute a value to submission.
  • Elements that are moved rather than removed keep working: reconnecting re-establishes what useEffectOnce set up, which upstream disposes and never restores.

Why "Unofficial"

This is a republished build of Fable.Lit by Alfonso García-Caro Núñez and its contributors, packaged from a fork so that fixes can be used before they land upstream. The toolchain is .NET 10, Fable 5, Fable.Core 4 and lit 3.

Reference this or upstream Fable.Lit, never both: they share the Lit namespace.

Product 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Fable.Lit.Unofficial:

Package Downloads
Fable.Lit.Elmish.Unofficial

Elmish integration for Fable.Lit. Unofficial build, republished from a fork while fixes are pending upstream.

Fable.Lit.React.Unofficial

React interop for Fable.Lit. Unofficial build, republished from a fork while fixes are pending upstream.

Fable.Lit.Feliz.Unofficial

Feliz-style API for Fable.Lit. Unofficial build, republished from a fork while fixes are pending upstream.

Fable.Lit.Test.Unofficial

Testing helpers for Fable.Lit. Unofficial build, republished from a fork while fixes are pending upstream.

Fable.LitStore.Unofficial

Reads a Fable.Store from a Fable.Lit component. Unofficial build: the original Fable.LitStore depends on upstream Fable.Lit, which cannot be referenced alongside this fork.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.19.0 209 8/14/2026
2.18.0 202 8/14/2026
2.17.0 217 8/14/2026
2.16.0 199 8/14/2026
2.15.0 191 8/14/2026
2.14.0 207 8/13/2026
2.13.0 190 8/13/2026
2.12.0 170 8/13/2026
2.11.0 191 8/13/2026
2.10.0 192 8/13/2026
2.9.0 176 8/13/2026
2.8.0 196 8/13/2026
2.7.1 199 8/13/2026
2.7.0 200 8/13/2026
2.6.0 191 8/12/2026
2.5.0 200 8/12/2026
2.4.0 202 8/12/2026
2.3.0 209 8/12/2026
2.2.0 185 8/12/2026
2.1.0 186 8/12/2026
Loading failed

Unofficial fork of Fable.Lit. Toolchain moved to .NET 10, Fable 5, Fable.Core 4 and lit 3; event handlers no longer raise FS3884. See the repository for what differs from upstream.