nwa*_*eru 53
我有同样的问题,我通过调整默认主题解决了这个问题。将以下代码添加到文件(您选择的名称).js
import { createMuiTheme } from '@material-ui/core/styles';
const theme = createMuiTheme({
typography: {
button: {
textTransform: 'none'
}
}
});
export default theme;
Run Code Online (Sandbox Code Playgroud)
然后,您可以在 index.js 中将该文件添加到您的应用程序中。我将它命名为 theme.js:
...
import theme from './theme';
...
const app = () => (
<ThemeProvider theme={theme}>
<CssBaseline />
<App />
</ThemeProvider>
);
ReactDOM.render(app, document.getElementById('root'));
Run Code Online (Sandbox Code Playgroud)
ebi*_*del 29
正如上面的注释中所提到的,按钮的材料设计规范指定文本应该是大写的,但您可以轻松覆盖其CSS属性:
paper-button {
text-transform: none;
}
Run Code Online (Sandbox Code Playgroud)
小智 23
受上面 CSS 样式的启发,这里是本地化按钮文本转换的内联样式 -
import {Button} from '@material-ui/core';
// Begin Component Logic
<Button style={{textTransform: 'none'}}>
Hello World
</Button>
// End Component Logic
Run Code Online (Sandbox Code Playgroud)
小智 16
如果你使用 Mui 5 那么你可以使用 sx语法
<Button sx={{textTransform: "none"}}/>
Run Code Online (Sandbox Code Playgroud)