DEV Community

Adarsh
Adarsh

Posted on

How to add Custom / Local fonts to React JS Project ?

Hey Everyone,

I want to add some custom / local fonts to my react project, can anyone tell me how to do it ?

Thanks

Top comments (5)

Collapse
 
ictekin profile image
ictekin

using import.

import './index.css';

index.css :
@font-face {
font-family: 'MyFont';
src: local('MyFont'), url(./fonts/MyFont.woff) format('woff');
}

or u can import your index.html file with using tag.

Collapse
 
adarshgoldar profile image
Adarsh

Hey @ictekin
I have used this method but it doesn't worked.

Collapse
 
ictekin profile image
ictekin

can u show something ? I dont know what is wrong. But import must be work 100% percent. İf u search little bit u can find what u want.

Thread Thread
 
adarshgoldar profile image
Adarsh • Edited
Thread Thread
 
ictekin profile image
ictekin

can i see your js file ? where u wanna use it