Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix label not being passed through for mo.ui.tabs (#9187)

Shahmir Varqha0a2ccf28a1d1
diff --git a/frontend/src/plugins/impl/TabsPlugin.tsx b/frontend/src/plugins/impl/TabsPlugin.tsx
index 005cafcbc2..1a2ad2cd7e 100644
--- a/frontend/src/plugins/impl/TabsPlugin.tsx
+++ b/frontend/src/plugins/impl/TabsPlugin.tsx
@@ -9,12 +9,14 @@ import {
} from "../../components/ui/tabs";
import { renderHTML } from "../core/RenderHTML";
import type { IPlugin, IPluginProps } from "../types";
+import { Labeled } from "./common/labeled";
interface Data {
/**
* The labels for each tab; raw HTML.
*/
tabs: string[];
+ label: string | null;
}
// Selected tab index
@@ -25,6 +27,7 @@ export class TabsPlugin implements IPlugin<T, Data> {
validator = z.object({
tabs: z.array(z.string()),
+ label: z.string().nullable(),
});
render(props: IPluginProps<T, Data>): JSX.Element {
@@ -47,6 +50,7 @@ interface TabComponentProps extends Data {
const TabComponent = ({
tabs,
+ label,
value,
setValue,
children,
@@ -67,17 +71,19 @@ const TabComponent = ({
}
return (
- <Tabs value={internalValue} onValueChange={handleChange}>
- <TabsList>
- {tabs.map((tab, index) => (
- <TabsTrigger key={index} value={index.toString()}>
- {renderHTML({ html: tab })}
- </TabsTrigger>
- ))}
- </TabsList>
- {React.Children.map(children, (child, index) => {
- return <TabsContent value={index.toString()}>{child}</TabsContent>;
- })}
- </Tabs>
+ <Labeled label={label} align="top">
+ <Tabs value={internalValue} onValueChange={handleChange}>
+ <TabsList>
+ {tabs.map((tab, index) => (
+ <TabsTrigger key={index} value={index.toString()}>
+ {renderHTML({ html: tab })}
+ </TabsTrigger>
+ ))}
+ </TabsList>
+ {React.Children.map(children, (child, index) => {
+ return <TabsContent value={index.toString()}>{child}</TabsContent>;
+ })}
+ </Tabs>
+ </Labeled>
);
};