CSS & Tailwind
Use Openbase with plain CSS in Vite, Remix, Astro, Svelte or any bundler.
Every family has a stylesheet with its @font-face rules and a CSS variable. Import the ones you use; your bundler copies the WOFF2 files.
npm install @openbase/fontsmain.ts
import "@openbase/fonts/sans.css";
import "@openbase/fonts/mono.css";
import "@openbase/fonts/drawn.css";
// or all three: import "@openbase/fonts";styles.css
body { font-family: var(--font-openbase-sans); }
code, pre { font-family: var(--font-openbase-mono); }
.handwritten { font-family: var(--font-openbase-drawn); }Families and variables
| Stylesheet | font-family | Variable |
|---|---|---|
| @openbase/fonts/sans.css | "OpenbaseSans" | --font-openbase-sans |
| @openbase/fonts/mono.css | "OpenbaseMono" | --font-openbase-mono |
| @openbase/fonts/drawn.css | "Openbase Drawn" | --font-openbase-drawn |
Each stylesheet declares weights 300, 400, 500, 600 and 700, upright and italic, with font-display: swap. The browser downloads only the faces a page uses.
Variable fonts
import "@openbase/fonts/sans-variable.css"; // any weight from 300 to 700
import "@openbase/fonts/mono-variable.css";
// or Sans + Mono variable and Drawn static: import "@openbase/fonts/variable.css";Same family names and CSS variables as the static stylesheets; use one or the other for a family, not both.
Tailwind CSS
Tailwind v4
@import "tailwindcss";
@import "@openbase/fonts";
@theme {
--font-sans: "OpenbaseSans", ui-sans-serif, system-ui, sans-serif;
--font-mono: "OpenbaseMono", ui-monospace, monospace;
--font-drawn: "Openbase Drawn", "OpenbaseSans", sans-serif;
}Tailwind v3 (tailwind.config.js)
export default {
theme: {
extend: {
fontFamily: {
sans: ["OpenbaseSans", "ui-sans-serif", "system-ui", "sans-serif"],
mono: ["OpenbaseMono", "ui-monospace", "monospace"],
drawn: ['"Openbase Drawn"', "OpenbaseSans", "sans-serif"],
},
},
},
};Without a bundler
Copy the WOFF2 files from the download to your server and declare them yourself:
@font-face {
font-family: "OpenbaseSans";
src: url("/fonts/OpenbaseSans-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
/* repeat for Light 300, Medium 500, SemiBold 600, Bold 700 */Tip: Preload the one or two weights used above the fold:
<link rel="preload" href="/fonts/OpenbaseSans-Regular.woff2" as="font" type="font/woff2" crossorigin>.