vike-react-antd
v1.0.0
Published
[Installation](#installation) [Settings](#settings) [Version history](https://github.com/vikejs/vike-react/blob/main/packages/vike-react-antd/CHANGELOG.md) [See Also](#see-also)
Downloads
88
Readme
vike-react-antd
Installation
Settings
Version history
See Also
Integrates Ant Design to your vike-react
app.
Installation
npm install vike-react-antd antd @ant-design/cssinjs
- Extend
+config.js
:// pages/+config.js import vikeReact from "vike-react/config" import vikeReactAntd from "vike-react-antd/config" export default { // ... extends: [vikeReact, vikeReactAntd] }
- You can now use Ant Design at any of your components.
import { Button, Flex } from "antd"; function SomeComponent() { return ( <Flex gap="small" wrap> <Button type="primary">Primary Button</Button> <Button>Default Button</Button> </Flex> ) }
[!NOTE] The
vike-react-antd
extension requiresvike-react
.
Settings
vike-react-antd
provides a configuration +antd
for customizing Ant Design Style Compatibility.
// pages/+antd.ts
export { antd }
import { legacyLogicalPropertiesTransformer, px2remTransformer, type StyleProviderProps } from "@ant-design/cssinjs"
const px2rem = px2remTransformer({
rootValue: 32, // 32px = 1rem; @default 16
})
const antd: Omit<StyleProviderProps, "children"> = {
hashPriority: "high",
layer: true,
transformers: [legacyLogicalPropertiesTransformer, px2rem],
}
You can remove Ant Design from some of your pages:
// pages/about/+antd.js
export const antd = null
For full customization consider ejecting.
[!NOTE] Consider making a Pull Request before ejecting.