我正在 React.js 中使用带有右边框的 MUI 组件创建自定义侧导航栏。
const SideNav = () => {
return (
<Stack
sx={{
bgcolor: 'background.paper',
borderColor: 'grey.500', //I want to color my border to grey.500
borderRight: 1,
top: 0,
left: 0,
position: 'fixed',
width: 80,
height: 1
}}
>
<Stack alignItems="center" spacing={2}>
<IconButton color="primary" aria-label="delete" size="large">
<DeleteIcon fontSize="medium" />
</IconButton>
</Stack>
</Stack>
)
}
export default SideNavRun Code Online (Sandbox Code Playgroud)
问题是我无法使用 MUI(Material UI)系统的主题颜色更改右边框的颜色。即使我将sx={{borderColor: 'grey.500'}}其设置为默认黑色。而且该应用程序正常执行,没有任何错误,但边框颜色仍然默认为黑色。