web-apis-websharper/UI/Components.fs
2025-07-28 01:05:33 -07:00

24 lines
631 B
Forth

namespace web_api_cookbook.UI
open WebSharper
open WebSharper.JavaScript
open WebSharper.UI
open WebSharper.UI.Client
open WebSharper.UI.Html
[<JavaScript>]
module Components =
module Button =
let plain attrs label =
button (attrs @ [attr.``type`` "button"; attr.``class`` "button"]) [ text label ]
module InputType =
let reset var () =
Var.Set var ""
let text attrs label =
let inputVal = Var.Create ""
let input = Doc.InputType.Text attrs inputVal
let doc = span [] [text label; input]
reset inputVal, inputVal.View, doc