How To Use Mdi Font With Next.js

naimahmedshuvo

Shuvo

Posted on July 10, 2022

How To Use Mdi Font With Next.js

1.Install mdi font into your project from their official web site or simply run this command in terminal

using npm

npm install @mdi/font
Enter fullscreen mode Exit fullscreen mode

using yarn

yarn add @mdi/font
Enter fullscreen mode Exit fullscreen mode

2.Import the css file from node_modules in your main.css or global.css file

@import url("@mdi/font/css/materialdesignicons.css");

Enter fullscreen mode Exit fullscreen mode
  1. In your component or pages use like this
<span className="mdi mdi-cube"></span>
Enter fullscreen mode Exit fullscreen mode

There your just need to change the class name to use different icon.

That's it.You have done with setup for using mdi icon.

Thanks For Reading.

💖 💪 🙅 🚩
naimahmedshuvo
Shuvo

Posted on July 10, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related