package bonsai
A library for building dynamic webapps, using Js_of_ocaml
Install
Dune Dependency
Authors
Maintainers
Sources
bonsai-v0.16.0.tar.gz
sha256=1d68aab713659951eba5b85f21d6f9382e0efa8579a02c3be65d9071c6e86303
doc/src/bonsai.kado/tabs.ml.html
Source file tabs.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
open! Core open! Import module Style = Tabs_style let make ~attrs ~per_tab_attr ~on_change ~equal ~active tabs = List.map tabs ~f:(fun (i, tab) -> let is_active = equal active i in let classes = if is_active then [ Style.tab_button; Style.selected ] else [ Style.tab_button ] in let on_click = Vdom.Attr.on_click (fun _ -> if equal i active then Effect.Ignore else on_change ~from:active ~to_:i) in Vdom.Node.div ~attrs:(classes @ [ on_click; per_tab_attr i ~is_active ]) [ tab ]) |> View.hbox ~attrs:(Style.tab_container :: attrs) ~gap:(`Em_float 0.5) ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>