Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added BitcountGridDoubleInk-VariableFont.woff2
Binary file not shown.
9 changes: 9 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
"icons": {
"library": "lucide"
},
"fonts": {
"heading": {
"family": "Random",
"source": "/BitcountGridDoubleInk-VariableFont.woff2",
"weight": 400,
"format": "woff2"
}
},
"navigation": {
"tabs": [
{
Expand Down Expand Up @@ -66,6 +74,7 @@
"group": "Components",
"pages": [
"text",
"settings/fonts",
"image-embeds",
"list-table",
"code",
Expand Down
151 changes: 151 additions & 0 deletions settings/fonts.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
---
title: "Fonts"
description: "Configure custom fonts"
icon: "type"
---

Configure fonts for your entire site or separately for headings and body text. Use Google Fonts, local font files, or externally hosted fonts. The default font varies by theme.

Fonts are controlled by the `fonts` property in your `docs.json`.

Check warning on line 9 in settings/fonts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

settings/fonts.mdx#L9

In general, use active voice instead of passive voice ('are controlled').

## Google Fonts

Check warning on line 11 in settings/fonts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

settings/fonts.mdx#L11

'Google Fonts' should use sentence-style capitalization.

Mintlify automatically loads [Google Fonts](https://fonts.google.com) when you specify a font family name.

```json
"fonts": {
"family": "Inter",
"weight": 400
}
```

## Local fonts

To use local fonts, place your font files in your project directory and reference them in your `docs.json` configuration.

### Setting up local fonts

<Steps>
<Step title="Add font files to your project">
For example, you can create a `fonts` directory and add your font files:

```
your-project/
├── fonts/
│ ├── InterDisplay-Regular.woff2
│ └── InterDisplay-Bold.woff2
├── docs.json
└── ...
```
</Step>

<Step title="Configure fonts in docs.json">
Reference your local fonts using relative paths from your project root:

```json docs.json
{
"fonts": {
"family": "InterDisplay",

Check warning on line 48 in settings/fonts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

settings/fonts.mdx#L48

Commas and periods go inside quotation marks.
"source": "/fonts/InterDisplay-Regular.woff2",

Check warning on line 49 in settings/fonts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

settings/fonts.mdx#L49

Commas and periods go inside quotation marks.
"format": "woff2",

Check warning on line 50 in settings/fonts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

settings/fonts.mdx#L50

Commas and periods go inside quotation marks.
"weight": 400
}
}
```
</Step>
</Steps>

### Local fonts for headings and body

You can configure separate local fonts for headings and body text:

```json docs.json
{
"fonts": {
"heading": {
"family": "InterDisplay",
"source": "/fonts/InterDisplay-Bold.woff2",
"format": "woff2",
"weight": 700
},
"body": {
"family": "InterDisplay",
"source": "/fonts/InterDisplay-Regular.woff2",
"format": "woff2",
"weight": 400
}
}
}
```

### External font URLs

You can also use external font URLs instead of local files:

```json docs.json
{
"fonts": {
"family": "Hubot Sans",
"source": "https://mintlify-assets.b-cdn.net/fonts/Hubot-Sans.woff2",
"format": "woff2",
"weight": 400
}
}
```

## Font configuration reference

<ResponseField name="fonts" type="object">
Font configuration for your documentation.

<Expandable title="Fonts">
<ResponseField name="family" type="string" required>
Font family name, such as "Inter" or "Playfair Display".
</ResponseField>
<ResponseField name="weight" type="number">
Font weight, such as 400 or 700. Variable fonts support precise weights such as 550.
</ResponseField>
<ResponseField name="source" type="string (uri)">
URL to your font source, such as `https://mintlify-assets.b-cdn.net/fonts/Hubot-Sans.woff2`, or path to your local font file, such as `/assets/fonts/InterDisplay.woff2`. Google Fonts are loaded automatically when you specify a Google Font `family` name, so no source URL is needed.
</ResponseField>
<ResponseField name="format" type="'woff' | 'woff2'">
Font file format. Required when using the `source` field.
</ResponseField>
<ResponseField name="heading" type="object">
Override font settings specifically for headings.

<Expandable title="Heading">
<ResponseField name="family" type="string" required>
Font family name for headings.
</ResponseField>
<ResponseField name="weight" type="number">
Font weight for headings.
</ResponseField>
<ResponseField name="source" type="string (uri)">
URL to your font source, such as `https://mintlify-assets.b-cdn.net/fonts/Hubot-Sans.woff2`, or path to your local font file for headings. Google Fonts are loaded automatically when you specify a Google Font `family` name, so no source URL is needed.
</ResponseField>
<ResponseField name="format" type="'woff' | 'woff2'">
Font file format for headings. Required when using the `source` field.
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="body" type="object">
Override font settings specifically for body text.

<Expandable title="Body">
<ResponseField name="family" type="string" required>
Font family name for body text.
</ResponseField>
<ResponseField name="weight" type="number">
Font weight for body text.
</ResponseField>
<ResponseField name="source" type="string (uri)">
URL to your font source, such as `https://mintlify-assets.b-cdn.net/fonts/Hubot-Sans.woff2`, or path to your local font file for body text. Google Fonts are loaded automatically when you specify a Google Font `family` name, so no source URL is needed.
</ResponseField>
<ResponseField name="format" type="'woff' | 'woff2'">
Font file format for body text. Required when using the `source` field.
</ResponseField>
</Expandable>
</ResponseField>
</Expandable>
</ResponseField>