Skip to content
This repository was archived by the owner on Feb 14, 2026. It is now read-only.

tabs #4

Description

@airtonix
  • render tabs and panes
  • horizontal vs vertical should be controlled by Flex/Grid components (not implemented within these components)

architecture:

 TabController
   Flex({ mode: 'fill })
     sized(Container, 64)
       Tab
       Tab
     Container
       Pane
       Pane
       Pane

Example usage

// setup state
const controller = new TabController();

const tab1 = new Tab("tab1", new Text(theme, "Label"), { 
  active: true,
  onSelect() { controller.setActive("tab1"); } // explicit control
}); 

const tab2 = new Tab("tab2", new Text(theme, "Label")); // implicit control 

controller.addTabs(tab1, tab2)

const pane1 = new Pane("tab1", new Text(theme, "Pane 1 Content")) // panes don't render if their related tab is inactive
const pane2 = new Pane("tab2", new Text(theme, "Pane 2 Content"))

controller.addPanes(pane1, pane2)

// setup rendering

const frame = new Flex({ mode: "fill" });
const sidebar = new Container()
sidebar.addChild(tab1)
sidebar.addChild(tab2)

const page = new Container()
page.addChild(pane1)
page.addChild(pane2)

frame.addChild(sized(sidebar))
frame.addChild(page)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions