import { Streamlit, StreamlitComponentBase, withStreamlitConnection, } from "streamlit-component-lib" import React, { ReactNode } from "react" import Button from "@mui/material/Button" import Tabs from "@mui/material/Tabs" import Tab from "@mui/material/Tab" import Box from "@mui/material/Box" import { ThemeProvider, createTheme } from "@mui/material" import { orange } from "@mui/material/colors" import Tooltip from "@mui/material/Tooltip" const theme = createTheme({ palette: { primary: orange, }, }) function BasicTabs({ tabs, selectedTab, json, }: { tabs: string[] selectedTab: number json?: { name: string; content: string } }) { const [value, setValue] = React.useState(selectedTab) const handleChange = (event: React.SyntheticEvent, newValue: number) => { Streamlit.setComponentValue(tabs[newValue]) setValue(newValue) } return (
{tabs.map((tab) => ( ))}
) } class StreamlitTabs extends StreamlitComponentBase<{}> { public render = (): ReactNode => { const tabs = this.props.args["tabs"] const selectedTab = this.props.args["selected_tab"] const json = this.props.args["json"] return ( ) } } export default withStreamlitConnection(StreamlitTabs)