|
| 1 | +--- |
| 2 | +title: "Fonts" |
| 3 | +description: "Configure custom fonts" |
| 4 | +--- |
| 5 | + |
| 6 | +Set a custom font 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. |
| 7 | + |
| 8 | +Fonts are controlled by the [fonts property](/organize/settings#param-fonts) in your `docs.json`. |
| 9 | + |
| 10 | +## Google Fonts |
| 11 | + |
| 12 | +Mintlify automatically loads [Google Fonts](https://fonts.google.com) when you specify a font family name in your `docs.json`. |
| 13 | + |
| 14 | +```json docs.json |
| 15 | +"fonts": { |
| 16 | + "family": "Inter" |
| 17 | +} |
| 18 | +``` |
| 19 | + |
| 20 | +## Local fonts |
| 21 | + |
| 22 | +To use local fonts, place your font files in your project directory and reference them in your `docs.json` configuration. |
| 23 | + |
| 24 | +### Setting up local fonts |
| 25 | + |
| 26 | +<Steps> |
| 27 | +<Step title="Add font files to your project"> |
| 28 | +For example, create a `fonts` directory and add your font files: |
| 29 | + |
| 30 | +```text |
| 31 | +your-project/ |
| 32 | +├── fonts/ |
| 33 | +│ ├── InterDisplay-Regular.woff2 |
| 34 | +│ └── InterDisplay-Bold.woff2 |
| 35 | +├── docs.json |
| 36 | +└── ... |
| 37 | +``` |
| 38 | +</Step> |
| 39 | + |
| 40 | +<Step title="Configure fonts in docs.json"> |
| 41 | +Reference your local fonts using relative paths from your project root: |
| 42 | + |
| 43 | +```json docs.json |
| 44 | +{ |
| 45 | + "fonts": { |
| 46 | + "family": "InterDisplay", |
| 47 | + "source": "/fonts/InterDisplay-Regular.woff2", |
| 48 | + "format": "woff2", |
| 49 | + "weight": 400 |
| 50 | + } |
| 51 | +} |
| 52 | +``` |
| 53 | +</Step> |
| 54 | +</Steps> |
| 55 | + |
| 56 | +### Local fonts for headings and body |
| 57 | + |
| 58 | +Configure separate local fonts for headings and body text in your `docs.json`: |
| 59 | + |
| 60 | +```json docs.json |
| 61 | +{ |
| 62 | + "fonts": { |
| 63 | + "heading": { |
| 64 | + "family": "InterDisplay", |
| 65 | + "source": "/fonts/InterDisplay-Bold.woff2", |
| 66 | + "format": "woff2", |
| 67 | + "weight": 700 |
| 68 | + }, |
| 69 | + "body": { |
| 70 | + "family": "InterDisplay", |
| 71 | + "source": "/fonts/InterDisplay-Regular.woff2", |
| 72 | + "format": "woff2", |
| 73 | + "weight": 400 |
| 74 | + } |
| 75 | + } |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +## Externally hosted fonts |
| 80 | + |
| 81 | +Use externally hosted fonts by referencing a font source URL in your `docs.json`: |
| 82 | + |
| 83 | +```json docs.json |
| 84 | +{ |
| 85 | + "fonts": { |
| 86 | + "family": "Hubot Sans", |
| 87 | + "source": "https://mintlify-assets.b-cdn.net/fonts/Hubot-Sans.woff2", |
| 88 | + "format": "woff2", |
| 89 | + "weight": 400 |
| 90 | + } |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +## Font configuration reference |
| 95 | + |
| 96 | +<ResponseField name="fonts" type="object"> |
| 97 | + Font configuration for your documentation. |
| 98 | + |
| 99 | + <Expandable title="Fonts"> |
| 100 | + <ResponseField name="family" type="string" required> |
| 101 | + Font family name, such as "Inter" or "Playfair Display". |
| 102 | + </ResponseField> |
| 103 | + <ResponseField name="weight" type="number"> |
| 104 | + Font weight, such as 400 or 700. Variable fonts support precise weights such as 550. |
| 105 | + </ResponseField> |
| 106 | + <ResponseField name="source" type="string (uri)"> |
| 107 | + 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. |
| 108 | + </ResponseField> |
| 109 | + <ResponseField name="format" type="'woff' | 'woff2'"> |
| 110 | + Font file format. Required when using the `source` field. |
| 111 | + </ResponseField> |
| 112 | + <ResponseField name="heading" type="object"> |
| 113 | + Override font settings specifically for headings. |
| 114 | + |
| 115 | + <Expandable title="Heading"> |
| 116 | + <ResponseField name="family" type="string" required> |
| 117 | + Font family name for headings. |
| 118 | + </ResponseField> |
| 119 | + <ResponseField name="weight" type="number"> |
| 120 | + Font weight for headings. |
| 121 | + </ResponseField> |
| 122 | + <ResponseField name="source" type="string (uri)"> |
| 123 | + 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. |
| 124 | + </ResponseField> |
| 125 | + <ResponseField name="format" type="'woff' | 'woff2'"> |
| 126 | + Font file format for headings. Required when using the `source` field. |
| 127 | + </ResponseField> |
| 128 | + </Expandable> |
| 129 | + </ResponseField> |
| 130 | + <ResponseField name="body" type="object"> |
| 131 | + Override font settings specifically for body text. |
| 132 | + |
| 133 | + <Expandable title="Body"> |
| 134 | + <ResponseField name="family" type="string" required> |
| 135 | + Font family name for body text. |
| 136 | + </ResponseField> |
| 137 | + <ResponseField name="weight" type="number"> |
| 138 | + Font weight for body text. |
| 139 | + </ResponseField> |
| 140 | + <ResponseField name="source" type="string (uri)"> |
| 141 | + 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. |
| 142 | + </ResponseField> |
| 143 | + <ResponseField name="format" type="'woff' | 'woff2'"> |
| 144 | + Font file format for body text. Required when using the `source` field. |
| 145 | + </ResponseField> |
| 146 | + </Expandable> |
| 147 | + </ResponseField> |
| 148 | + </Expandable> |
| 149 | +</ResponseField> |
0 commit comments