【发布时间】:2021-04-07 09:04:07
【问题描述】:
我正在使用 Material-UI 中的Scrollable tabs。如何更改滚动箭头的svg 图标?
我看到您可以使用 TabScrollButton 组件。那么我必须为左右箭头创建一个吗?
在 Tabs 组件中,您可以传递一个 prop ScrollButtonComponent。但是我必须如何使用它呢?
我在下面尝试过,但还不行:
import Tab from '@material-ui/core/Tab';
import Tabs from '@material-ui/core/Tabs';
import TabScrollButton from '@material-ui/core/TabScrollButton';
import { CloseIcon } from 'app/components/atoms/icons';
const MyCarousel = ({ value }: Props) => {
const selectedItem = value;
const scrollButton = () => {
return (
<div>
<TabScrollButton orientation="horizontal" direction="right">
{CloseIcon}
</TabScrollButton>
</div>
);
};
return (
<div css={styles.root}>
<Tabs
value={value}
indicatorColor="primary"
variant="scrollable"
scrollButtons="auto"
aria-label="scrollable auto tabs example"
ScrollButtonComponent={scrollButton}
>
<Tab label="Item One" />
<Tab label="Item Two" />
<Tab label="Item Three" />
<Tab label="Item 4" />
<Tab label="Item 5" />
<Tab label="Item 6" />
<Tab label="Item 7" />
<Tab label="Item 8" />
<Tab label="Item 9" />
</Tabs>
</div>
);
};
export default MyCarousel;
【问题讨论】:
标签: reactjs tabs material-ui