# Tabs Widget Proposal ## Overview A new **Tabs Widget** that allows organizing content into multiple switchable tabs. Each tab will contain its own nested layout, capable of holding multiple widgets, similar to the `LayoutContainerWidget`. ## Data Structure The widget will maintain a list of tabs, where each tab holds a reference to a unique "Virtual Page ID" essentially acting as a container for other widgets. ```typescript interface TabDefinition { id: string; // Unique identifier for the tab label: string; // Display text layoutId: string; // The 'pageId' used for the nested GenericCanvas icon?: string; // Optional icon name } interface TabsWidgetProps { tabs: TabDefinition[]; activeTabId: string; orientation: 'horizontal' | 'vertical'; tabBarPosition: 'top' | 'bottom' | 'left' | 'right'; className?: string; // Container classes tabBarClassName?: string; // Tab bar specific classes contentClassName?: string; // Content area classes } ``` ## Implementation Strategy ### 1. Widget Registration (`registerWidgets.ts`) Register a new `TabsWidget` with a custom configuration schema. - **Tabs Management**: A dedicated property editor (array of objects) to add/remove/reorder tabs and rename them. - **Orientation/Position**: Selectors for tab bar placement. - **Styling**: Tailwind CSS class pickers for container, tab bar, and content area. ### 2. Component Structure (`TabsWidget.tsx`) The component will render: 1. **Tab Bar**: A list of buttons/tabs. 2. **Content Area**: renders a `GenericCanvas` for the currently active tab. ```tsx // simplified pseudo-code const TabsWidget = ({ tabs, activeTabId, ...props }) => { const [currentTabId, setCurrentTabId] = useState(activeTabId || tabs[0]?.id); const currentTab = tabs.find(t => t.id === currentTabId); return (