JavaScript libraries

Seamlessly use JavaScript libraries from F#

Charts, maps and grids drive Plotly, Leaflet and SlickGrid through WebSharper's typed JavaScript bindings — no hand-written interop. Forms shows the same idea with WebSharper's own typed form layer.

F# source Live preview
F# / Source
Live Preview

Samples

Learn by example

Every sample is a complete, open-source application built with WebSharper. The client-side ones compile to JavaScript and run entirely in the browser; the full-stack ones share F# types between a .NET server and the client.

Client-only samples

No server code — every one is live on GitHub Pages.

9 live demos
The 2048 game board with numbered tiles and a score panel

2048

The classic sliding-tile game, reimplemented in F#. Three variants — Original, Fibonacci and PlusMinus — with a reactive board and all styling in the template.

WebSharper.UI Game SPA
A TodoMVC list with completed and active entries

Mvu TodoMVC

TodoMVC built with WebSharper.Mvu: a typed model, messages and update functions, composed into pages, with All/Active/Completed routing.

WebSharper.Mvu Routing SPA
A D3 globe highlighting a country in the World Tour demo

D3 World Tour

mbostock's rotating globe, drawn with the typed D3 binding — it spins around the world and pauses on every country in turn.

D3 Visualization Canvas
Math.js big-number results and a symbolically differentiated formula typeset by MathJax

MathJS

A tour of math.js: arbitrary-precision numbers, symbolic differentiation, vectors, matrices and units, with TeX results typeset by MathJax.

math.js MathJax Computation
A jsPDF document editor next to a rendered PDF preview

JsPDF

Compose a document in the browser, watch jsPDF render it live, then download it — with automatic line wrapping and page breaks.

jsPDF Documents esbuild
A CodeMirror 6 editor showing a JavaScript snippet

CodeMirror

A CodeMirror 6 playground configured entirely from F#: eight languages, line numbers and a one-click dark theme.

CodeMirror Editor esbuild
A validated WebSharper.Forms with two pets and a submit button

Forms

Typed, validated forms with WebSharper.Forms: per-field errors as you type and a dynamic list of pets you can add, reorder or delete.

WebSharper.Forms Validation Reactive
Web Speech text-to-speech and speech-to-text panels

WebSpeech

Text-to-speech and live speech-to-text through the Web Speech API — no third-party JavaScript library involved.

Web Speech Browser API Reactive
A shopping cart with laptops and a populated cart summary

ShoppingCart

A reactive shopping cart with a ListModel of items, per-item quantity controls and a live total — a compact tour of WebSharper.UI collections.

WebSharper.UI ListModel SPA

Full-stack samples

Shared F# types across a real .NET server and the browser. No hosted demos here — clone a repo and run it locally.

Server + client
A live chart streaming data over a WebSocket next to a message log

WebSocketChart

Server + client

A typed StatefulAgent on the server pushes a new value every second over /ws; the client turns the JSON stream into a live Chart.js line chart and a message log.

ASP.NET Core WebSockets Chart.js
Source on GitHub Run locally to see it stream
The People client showing a table of people with edit and delete actions

A REST CRUD pair that shares its model and endpoints by project reference: sitelets on the server, a WebSharper.Mvu client with list, create and edit pages plus client-side routing. The two sides stay in sync by construction.

Sitelets REST WebSharper.Mvu
API source Client source Run both projects locally