Fixing font styling issues in your SPFx application customizers

Application Customizer SPFx SharePoint Framework Styling
post

This post is over a year old, some of this information may be out of date.

This will be a quick tip about a styling issue with the application customizers. If you are building application customizers that render something in the available top or bottom zones. It is recommended to add your own font styles. This might sound weird, but when you don’t do this, you might end up with styling differences between your pages.

Here is an example of loading a sample application customizer on a modern page and in a list view:

Show image Font size differences between pages
Font size differences between pages

The text on the list view is a bit bigger. The reason for this font size difference is that the body element on a modern page contains the ms-font-m class. This automatically sets the font size to 14px and font weight to 400.

Show image ms-font-m class on body
ms-font-m class on body

On all other pages, this class is not present and due to that differences will occur.

Show image No ms-font-m class present
No ms-font-m class present

An easy fix would be to add the ms-font-m class on the root element from your application customizer.

Building on Microsoft 365? Let's work together I help product teams with SharePoint Framework architecture, end-to-end testing and CI/CD. Get in touch →

Want the next article?

Subscribe to the RSS feed, or follow me where I share new posts.

Related articles

Report issues or make changes on GitHub

Found a typo or issue in this article? Visit the GitHub repository to make changes or submit a bug report.

Comments

Elio Struyf

I build developer tools · Microsoft 365 architect · Speaker

Loading...

Let's build together

All your AI coding agents in one window

Present from VS Code

Manage content in VS Code

See all my projects →