Tailwind
Use Tailwind CSS utility classes in Format Studio documents.
Supported frameworks
| Framework | Supported |
|---|---|
| React | |
| Vue | |
| HTML |
Installation
Install the Tailwind CSS package.
npm install tailwindcss --save-devpnpm add tailwindcss --save-devyarn add tailwindcss --devbun add tailwindcss --devUsage
Import Tailwind into a stylesheet.
documents
invoice
styles.css
index.tsx
@import 'tailwindcss';
.custom-class {
@apply rounded-b-lg shadow-md;
}
@layer utilities {
.peach {
background: peachpuff;
}
}Make sure the stylesheet is imported into your document entry point. This import only needs to be done once, in the entry file.
Import Tailwind into a stylesheet.
documents
invoice
styles.css
index.vue
@import 'tailwindcss';
.custom-class {
@apply rounded-b-lg shadow-md;
}
@layer utilities {
.peach {
background: peachpuff;
}
}Make sure the stylesheet is imported into your document entry point. This import only needs to be done once, in the entry file.
<script setup lang="ts">
import { Document, Layout } from '@format.dev/vue'
</script>
<template>
<Document title="Invoice">
<Layout id="invoice" :width="793.71" :height="1122.52">
<div class="peach custom-class m-2 flex">
Hey, 🍑
</div>
</Layout>
</Document>
</template>
<style>
@import './styles.css';
</style>Import Tailwind into a stylesheet.
documents
invoice
styles.css
index.html
index.ts
@import 'tailwindcss';
.custom-class {
@apply rounded-b-lg shadow-md;
}
@layer utilities {
.peach {
background: peachpuff;
}
}Make sure the stylesheet is imported into your document entry point. This import only needs to be done once, in the entry file.
export { default } from './index.html'
import './styles.css'Fonts
Point Tailwind's font property overrides back to the Format's built-in families with an @theme block:
@import 'tailwindcss';
@theme {
--font-sans: var(--font-sans-system);
--font-serif: var(--font-serif-system);
--font-mono: var(--font-mono-system);
}Was this page helpful?