How can I override an antd style?
See original GitHub issueI’m not sure if it is a bug or not, but in antd 2.7.0, the modal footer style looks like this:
.ant-modal-footer {
border-top: ...
padding: 10px 18px 10px 10px;
text-align: ...
border-radius: ...
}
Why is the padding-right 18px and not 10px? This creates asymmetry.
I’m trying to import a less file to override it:
@import "../../node_modules/antd/lib/style/themes/default.less";
: global {
.ant-modal-footer {
padding: 10px 10px 10px 10px;
}
}
But it gets overridden by the default style.
Issue Analytics
- State:
- Created 7 years ago
- Comments:21 (3 by maintainers)
Top Results From Across the Web
Antd: How to override style of a single instance of a component
I'm using webpack to import the antd.less file in a global App.less file. Then I override some global styles and webpack bundles everthing:...
Read more >Customize Theme - Ant Design
Themes with different styles can be quickly generated by modifying ... Similarly, other Design Token of components can also be overridden in this...
Read more >Ant Design CSS Override Demo - CodeSandbox
Ant Design CSS Override Demo. 1. Embed Fork Create Sandbox Sign in. Sandbox Info ... button. index.js. styles.css. package.json. Dependencies. antd.
Read more >How to use styled-components for AntD
styled-components is an npm library to help overwrite CSS styling. Note that AntD uses its own css classes to style its components. You...
Read more >A baby guide to overriding AntDesign theme and color.
Step 5: On this path /node_module/antd/dist run this command lessc --js my-theme.less result.css or compile it inside the project style ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
antd’s style:
Your style:
Then, you can override it
In your js file you wrap antd button inside your own parent tag (e.g. “saveButtonWrapper”):
In less file nest the .ant-… classes inside your own parent tag’s className (in order to avoid overriding all the antd classes in the whole app after code compilation). Write there your own css properties, for example:
If you still need more detailed explanation, please refer to the video I posted on YouTube on how to customize Ant Design components - tabs.