Typography
Harmonic typographic scales for better looking UI
Rhythm and Harmony
UI Foundations Kit uses a typographic scale that is based on the golden ratio. This scale is used to create harmonious and visually appealing typography automatically. This is based off recommendations by Inter’s Dynamic Metrics.
This is how the Typography
component is customized to work:
The default UI Foundations theme automatically applies these adjustments to the <Typography />
component, so you don’t have to worry about it.
Styled System fontSize
s
UI Foundations Kit also adds the sm
, md
, lg
, etc. fontSize
modifiers from libraries like Styled System and Tailwind. In addition to defining styles using the sx
prop, you can pass in a string modifier like fontSize="lg"
to adjust the font size of text in a component.
Fonts
By default, UI Foundations Kit uses the Inter
font family for all text. This font is a modern sans-serif typeface that is designed for legibility and readability on screens. It is also open-source and free to use in your projects.
The vite-ts/src/context/ThemeCustomizationProvider.tsx
has a series of fonts that are held in state as well. There are 4 fonts installed via Google Fonts for starters.
- Inter
- Roboto
- Ubuntu
- Manrope
You can find their installations in the vite-ts/index.html
file.
You can replace these font with any other fonts you’re interested in as well. These fonts are toggled in the theme file to allow you to preview other fonts from the global theme switcher.
MUI encourages you to define the font family used by your app in the theme file, which UI Foundations Kit does as well, but overrides with an additional activeFont
for use via the theme switcher. If you are not interested in the theme switcher, it can be removed in favor of a sole default.
Preview different fonts
The live demo allows you to preview the installed fonts from the theme switcher, if you’re interested in seeing how different fonts look within the context of the app.