mantine: 配置使用
如何在项目中搭建 mantine 的使用
01 安装核心包
安装
js
包
yarn add @mantine/core @mantine/hooks
02 引入核心的 css
在
App.tsx
中加入这个
// core styles are required for all packages
import '@mantine/core/styles.css';
// other css files are required only if
// you are using components from the corresponding package
// import '@mantine/dates/styles.css';
// import '@mantine/dropzone/styles.css';
// import '@mantine/code-highlight/styles.css';
// ...
03 添加必须的 provider
这个通常在
App.tsx
中
import { createTheme, MantineProvider } from '@mantine/core';
const theme = createTheme({
/** Put your mantine theme override here */
});
function Demo() {
return (
<MantineProvider theme={theme}>
{/* Your app here */}
</MantineProvider>
);
}