// needs JQuery
sclass HTMLTabs {
S id = "tabs_" + aGlobalID();
new L tabs;
class Tab {
S id = aGlobalID();
S label;
S contents;
}
S html() {
ret div(
div(mapToLines(tabs, tab ->
div(tab.label, class := "tab-selector", onclick := "$(" + jsQuote("#" + id + " .tab-page") + ").hide(); "
+ "$(" + jsQuote("#" + tab.id) + ").show();"))
, class := "tab-selectors")
+ mapToLines(tabs, tab ->
div(tab.contents, class := "tab-page", style := tab == first(tabs) ? "" : "display: none")),
+id, class := "tabs-container");
}
}