- Ant Design X
- Changelogv2.1.3
- Model Integration
- Agent Integration
- Basic Usage
- Advanced Usage
- Migration
- Other
Style Compatibility
@layer Style Priority Demotion>=5.17.0Ant Design X supports configuring layer for unified priority demotion. After demotion, antdx styles will always have lower priority than default CSS selectors, making it easier for users to override styles (please be sure to check @layer browser compatibility). When StyleProvider enables layer, child elements must be wrapped with XProvider to update icon-related styles:
import { StyleProvider } from '@ant-design/cssinjs';import { XProvider } from '@ant-design/x';export default () => (<StyleProvider layer><XProvider><Bubble /></XProvider></StyleProvider>);
antd and antdx styles will be encapsulated in @layer to reduce priority:
++ @layer antd {:where(.css-cUMgo0).ant-btn {color: #fff;}++ }++ @layer antdx {:where(.css-bAMboO).ant-sender {width: 100%;}++ }
When using, you need to manually adjust @layer to control the style override order:
@layer antd, antdx;
In global.css, adjust @layer to control the style override order. Place tailwind-base before antd and antdx:
@layer tailwind-base, antd, antdx;@layer tailwind-base {@tailwind base;}@tailwind components;@tailwind utilities;
In global.css, adjust @layer to control the style override order, placing antd and antdx in appropriate positions:
@layer theme, base, antd, antdx, components, utilities;@import 'tailwindcss';
For more information, please refer to antd Style Compatibility.