import type { FlatTemplatable } from "tempstream"; import { TempstreamJSX } from "tempstream"; const ids = (function* () { let i = 0; while (true) { yield i++; } })(); export function tabs({ tabs, default_tab, tab_bar, remember_tab = false, active_navbar_tab_style = "", }: { tabs: { id: string; label?: string; content: FlatTemplatable }[]; default_tab: string; tab_bar?: FlatTemplatable; remember_tab?: boolean; active_navbar_tab_style?: string; }) { const tab_section_id = ids.next().value; return (
{tab_bar || ( )} {tabs.map(({ id, content }) => { const tab_id = `tabs__${tab_section_id}__tab__${id}`; return (
{ /* HTML */ `` } {content}
); })}
); }