Reputation: 637
I'd like to import a few components from the Ant Design React CSS library
but I can't manage to get it working. I want to be able to import a single component without it messing up with the rest of my CSS
.
Here's what I've tried:
import Button from 'antd/lib/button';
import 'antd/lib/button/style';
===> does not import the style.
import Button from 'antd/lib/button';
import 'antd/lib/button/style/css';
===> works, but messes up with the rest of the App
I have tried to do what is written here, import AntD on demand:
===> does not work, does not import the style
My question: is there a step-by-step guide to do what I want?
I'm not the only one who wants to do that and has problems, here, a guy on Reddit, I found many others links and have tried every single thing, absolutely nothing worked.
Thanks!
Upvotes: 12
Views: 8375
Reputation: 21
You could try to import the index of the antd css file itself, like this:
import 'antd/lib/spin/style/index.css';
Upvotes: 2
Reputation: 1755
import { Spin, Icon } from 'antd';
import 'antd/lib/spin/style/css';
worked for me antd version 3.17.0
Upvotes: 3
Reputation: 458
import {Button} from 'antd'
import 'antd/lib/button/style';
worked for me...
what do you mean by
'===> does not import the style.`
???
Upvotes: 3