> For the complete documentation index, see [llms.txt](https://docs.keycloakify.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keycloakify.dev/common-use-case-examples/custom-fonts.md).

# Custom Fonts

## Using a web font service

Let's see how to use, for example, [Playwrite Netherland](https://fonts.google.com/specimen/Playwrite+NL) via Google Fonts.\
\
Create the following CSS file:

{% code title="src/login/main.css" %}

```css
@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&family=Playwrite+NL:wght@100..400&family=Playwrite+PL:wght@100..400&display=swap');

.kcHeaderWrapperClass {
    /* NOTE: We would use `body {` if we'd like the font to be applied to everything. */
    font-family: "Playwrite NL", cursive;
}
```

{% endcode %}

Then import it as a global stylesheet:

{% tabs %}
{% tab title="React" %}

<pre class="language-tsx" data-title="src/login/KcApp.tsx"><code class="lang-tsx"><strong>import "./main.css";
</strong>// ...
</code></pre>

{% endtab %}

{% tab title="Angular" %}

<pre class="language-tsx" data-title="src/login/KcApp.ts"><code class="lang-tsx"><strong>import "./main.css";
</strong>// ...
</code></pre>

{% endtab %}

{% tab title="Svelte" %}

<pre class="language-html" data-title="src/login/KcPage.svelte"><code class="lang-html">&#x3C;script lang="ts">
<strong>  import "./main.css";
</strong>  import Template from '@keycloakify/svelte/login/Template.svelte';
  ...
</code></pre>

{% endtab %}
{% endtabs %}

That's it!

<figure><img src="https://2643300760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ls5iTdfTS2xECgBfw90%2Fuploads%2Fgit-blob-88ad68094f972e9ed85f173ab0724fea221cf7f1%2Fimage%20(92).png?alt=media" alt="" width="375"><figcaption><p>Playwrite NL successfully applied to the header</p></figcaption></figure>

## Using self hosted fonts

Keycloak is often used in enterprise internal network with strict network traffic control. In this context, using a Font CDN isn't an option, you want the font to be bundled in your JAR and served directly by the Keycloak server.

Let's see how we would use a self hosted copy [Vercel's Geist](https://vercel.com/font) font.

First let's download and extract [the font files](https://github.com/keycloakify/keycloakify/releases/download/v0.0.1/geist.zip) in `src/login/assets/fonts/geist/`:

<figure><img src="https://2643300760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ls5iTdfTS2xECgBfw90%2Fuploads%2Fgit-blob-47f7c2f9e43f022879c75c9ef21f8c6a621ae1fc%2Fimage%20(84).png?alt=media" alt="" width="375"><figcaption></figcaption></figure>

Now let's set Geist as the default font.

Create the following CSS file:

{% code title="src/login/main.css" %}

```css
@import url(./assets/fonts/geist/main.css);

body {
  font-family: Geist;
}
```

{% endcode %}

Then import it as a global stylesheet:

{% tabs %}
{% tab title="React" %}

<pre class="language-tsx" data-title="src/login/KcPage.tsx"><code class="lang-tsx"><strong>import "./main.css";
</strong>// ...
</code></pre>

{% endtab %}

{% tab title="Angular" %}

<pre class="language-tsx" data-title="src/login/KcApp.ts"><code class="lang-tsx"><strong>import "./main.css";
</strong>// ...
</code></pre>

{% endtab %}

{% tab title="Svelte" %}

<pre class="language-html" data-title="src/login/KcPage.svelte"><code class="lang-html">&#x3C;script lang="ts">
<strong>  import "./main.css";
</strong>  import Template from '@keycloakify/svelte/login/Template.svelte';
  ...
</code></pre>

{% endtab %}
{% endtabs %}

That's it!

<figure><img src="https://2643300760-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ls5iTdfTS2xECgBfw90%2Fuploads%2Fgit-blob-f3326877f898654fe76a88e6447be0b48541f15f%2Fimage%20(121).png?alt=media" alt=""><figcaption><p>Geist successfully applied</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.keycloakify.dev/common-use-case-examples/custom-fonts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
