Skip to content
websharper-samplesPublic

About

An experiment in next-generation front-end combinator library for WebSharper

Resources

Stars

39 stars

Watchers

13 watching

Forks

Latest commit

 

History

278 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebSharper.UI samples

A gallery of eight complete apps and five guided suites built with WebSharper.UI — the reactive, composable user-interface library for F#. Everything is compiled from F# to JavaScript and runs entirely in the browser; the gallery itself is a WebSharper.UI SPA.

WebSharper.UI samples

Try it live · WebSharper · Library source

Apps

Substantive, self-contained applications that combine variables, views, collections, forms, async loading and SVG charts.

App What it demonstrates
Dashboard Live KPIs, range controls and an animated trend chart fed by a timer
Kanban board Drag-and-drop columns, priorities and search over a ListModel
Expense tracker Forms, typed categories, a budget bar and a live breakdown
Data explorer Async CSV loading, search, sorting, paging and row details
Todos Priorities, filters, progress and bulk actions
Community board Sign-in, threads, replies and search over a simulated async service
Game of Life A cellular automaton with timers, speed control and a reactive grid
Onboarding flow A validated, animated multi-step Flow with review and restart

Suites

Focused tours of one part of the library, with several demos per page.

Suite Contents
Reactive basics Vars, derived views, HTML templates and a small calculator
Collections & selection Filterable lists, editable records, check boxes and radios
Pointer & keyboard Live mouse/keyboard views, a click pad and a virtual keyboard
Chart lab Animated CSV-driven bar charts and sortable SVG charts
Mini-site A routed, animated multi-page site nested in the gallery router

How it works

  • src/wwwroot/index.html is the whole-page HTML template. Its two typed holes — ws-hole="Nav" and ws-hole="Main" — are filled by the site shell:

    ShellTemplate()
        .Nav(NavBar var)
        .Main(main)
        .Bind()
  • src/Samples.fs defines the sample catalogue, the app/suite grouping and the route type. Routing is hash-based (#/samples/Dashboard), so the static build works on GitHub Pages without server rewrites.

  • Each app and suite lives in its own F# file and registers itself with Samples.Build(...). There are no external UI or chart dependencies: the charts in src/Charts.fs are small SVG helpers, and the design system in src/wwwroot/style.css is self-contained.

Project structure

ui/
  src/
    Utilities.fs            # shared UI helpers
    Charts.fs               # dependency-free SVG chart components
    Samples.fs              # catalogue, sidebar, sample framework
    Site.fs                 # shell, home page, navigation, routing
    Client.fs               # [<SPAEntryPoint>]
    Dashboard.fs            # \
    KanbanBoard.fs          #  |
    ExpenseTracker.fs       #  |  apps
    DataExplorer.fs         #  |
    TodoApp.fs              #  |
    CommunityBoard.fs       #  |
    GameOfLife.fs           #  |
    OnboardingFlow.fs       # /
    VarPlayground.fs        # \
    CollectionsSuite.fs     #  |
    InputInspector.fs       #  |  suites
    ChartLab.fs             #  |
    MiniSite.fs             # /
    InputTransformTemplate.html
    wwwroot/
      index.html            # whole-page gallery template
      style.css             # self-contained design system
      DataExplorer.csv      # dataset for the data explorer
      ObjectConstancy.csv   # dataset for the chart lab
      AlphaFrequency.csv    # dataset for the chart lab
      files/                # logo
    wsconfig.json           # WebSharper SPA settings
    package.json            # esbuild
    esbuild.config.mjs      # bundles Release output into dist/
  docs/screenshot.png
  .github/workflows/deploy.yml
  README.md

Running locally

The site is fully static: build it in Release, then serve dist/.

dotnet build src/WebSharper.UI.Samples.fsproj -c Release
python3 -m http.server 5290 --bind 127.0.0.1 --directory dist

Open http://127.0.0.1:5290/. (npm run serve does the same from src/.)

Building

dotnet build src/WebSharper.UI.Samples.fsproj -c Release

WebSharper compiles the F# sources to src/build/, and esbuild bundles the entry point to dist/Scripts/WebSharper.UI.Samples.min.js while copying the static assets to dist/.

Deployment

Every push to main triggers .github/workflows/deploy.yml, which builds in Release and publishes dist/ to the gh-pages branch with GitHub Pages.


Built with WebSharper. WebSharper is open source; see the library repository.

About

An experiment in next-generation front-end combinator library for WebSharper

Resources

Stars

39 stars

Watchers

13 watching

Forks

Releases

Packages

Used by

Contributors

Languages