Firelight 0.2.0
dotnet add package Firelight --version 0.2.0
NuGet\Install-Package Firelight -Version 0.2.0
<PackageReference Include="Firelight" Version="0.2.0" />
<PackageVersion Include="Firelight" Version="0.2.0" />
<PackageReference Include="Firelight" />
paket add Firelight --version 0.2.0
#r "nuget: Firelight, 0.2.0"
#:package Firelight@0.2.0
#addin nuget:?package=Firelight&version=0.2.0
#tool nuget:?package=Firelight&version=0.2.0
Firelight
Web Components for F#. Build reactive, standards-based UI components using Lit and Fable.
Firelight gives you idiomatic F# bindings to Lit's lightweight Web Components platform - type-safe reactive properties, composable templates, the Elmish MVU loop, and cross-component context - all compiling to lean, standards-compliant JavaScript.
Packages
| Package | Description |
|---|---|
Firelight |
Core bindings: LitElement, html/css templates, directives, reactive properties |
Firelight.Context |
Context protocol for sharing state across component trees without prop drilling |
Firelight.Elmish |
Elmish (MVU) integration via reactive controllers |
Quick Start
Define a component by inheriting LitElement, declare reactive properties, and implement render:
open Firelight
open Fable.Core.JsInterop
type Counter() =
inherit LitElement()
let mutable count = 0
override _.render() =
html $"""
<p>Count: {count}</p>
<button @click={fun _ -> count <- count + 1; base.requestUpdate()}>
Increment
</button>
"""
defineElement<Counter> "my-counter"
Use it anywhere in HTML:
<my-counter></my-counter>
Elmish Integration
For components with non-trivial state, Firelight.Elmish wires an Elmish Program directly to the component lifecycle:
open Firelight
open Firelight.Elmish
type Msg = Increment | Decrement
type Counter() =
inherit LitElement()
let elmish =
ElmishController.simple(
base,
init = fun () -> 0,
update = fun msg model ->
match msg with
| Increment -> model + 1
| Decrement -> model - 1
)
override _.render() =
let model = elmish.model
html $"""
<button @click={fun _ -> elmish.dispatch Decrement}>-</button>
<span>{model}</span>
<button @click={fun _ -> elmish.dispatch Increment}>+</button>
"""
defineElement<Counter> "my-counter"
Context
Firelight.Context lets you broadcast state (like an Elmish dispatch function) to any descendant component, regardless of nesting depth:
open Firelight.Context
// Define a typed context
let dispatchContext = LitContext.createContext<Symbol, Msg -> unit>()
// Provide it from a parent component
let provider = ContextProvider(host, dispatchContext, dispatch)
// Consume it in any descendant
let consumer = ContextConsumer(host, dispatchContext)
Documentation
- Official Lit Documentation - for a complete API reference
- Components and Templates - architectural guide covering component patterns, template composition, and communication strategies
- Elmish DevTools - persisting Elmish state to
localStoragefor better HMR development experience - Sample Projects - annotated examples from a basic tutorial to a full drag-and-drop Kanban board
Getting Started
See the GettingStarted sample for a guided walkthrough covering reactive properties, styles, events, controllers, context, and Elmish - each concept in its own focused module.
License
MIT
| 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. 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. |
-
.NETStandard 2.0
- Fable.Browser.Css (>= 2.5.0)
- Fable.Browser.Dom (>= 2.20.0)
- Fable.Browser.Event (>= 1.7.0)
- Fable.Core (>= 4.5.0)
- FSharp.Core (>= 6.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Firelight:
| Package | Downloads |
|---|---|
|
Firelight.Context
Package Description |
|
|
Firelight.Elmish
Package Description |
|
|
Firelight.Router
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.