Skip to content

Typography

Semantic typography styles for long-form prose content.

The typography plugin provides a set of prose-* shortcuts that style long-form HTML content (articles, blog posts, documentation) with sensible typographic defaults.

sh
pnpm add -D @pikacss/plugin-typography
sh
npm install -D @pikacss/plugin-typography
sh
yarn add -D @pikacss/plugin-typography
ts
import { defineEngineConfig } from '@pikacss/core'
import { typography } from '@pikacss/plugin-typography'

export default defineEngineConfig({
	plugins: [typography()],
})

Available shortcuts:

ShortcutPurpose
prose-baseBase prose container styles shared by the other prose-* shortcuts
proseBase prose styling — applies all component styles
prose-paragraphsParagraph spacing and line height
prose-linksLink colors and underline
prose-emphasisBold and italic styling
prose-kbdKeyboard input styling
prose-listsOrdered and unordered list styling
prose-hrHorizontal rule styling
prose-headingsHeading sizes and spacing
prose-quotesBlockquote styling
prose-mediaImage and video styling
prose-codeInline code and code block styling
prose-tablesTable styling

Size variants:

ShortcutPurpose
prose-smSmall prose sizing
prose-lgLarge prose sizing
prose-xlExtra large prose sizing
prose-2xlDouble extra large prose sizing

Usage:

The typography shortcuts are regular pika() inputs. For example, you can apply a focused module shortcut like this:

ts
const articleLinksClassName = pika('prose-links')
css
@layer utilities {
  .pk-a {
    color: var(--pk-prose-color-body);
  }
  .pk-b {
    max-width: 65ch;
  }
  .pk-c {
    font-size: 1rem;
  }
  .pk-d {
    line-height: 1.75;
  }
  .pk-e > :first-child {
    margin-top: 0;
  }
  .pk-f > :last-child {
    margin-bottom: 0;
  }
  .pk-g a {
    color: var(--pk-prose-color-links);
  }
  .pk-h a {
    text-decoration: underline;
  }
  .pk-i a {
    font-weight: 500;
  }
  .pk-j a strong {
    color: inherit;
  }
  .pk-k a code {
    color: inherit;
  }
}

Prose color roles use --pk-prose-color-* CSS variables such as --pk-prose-color-body, --pk-prose-color-links, and --pk-prose-color-headings. Keyboard key shadows use --pk-prose-kbd-shadows.

Config

Configure the plugin through the top-level typography key in your engine config.

PropertyDescription
variablesNested under typography. CSS variable overrides for the registered prose variables, including the --pk-prose-color-* set and --pk-prose-kbd-shadows.
ts
import { defineEngineConfig } from '@pikacss/core'
import { typography } from '@pikacss/plugin-typography'

export default defineEngineConfig({
	typography: {
		variables: {
			'--pk-prose-color-links': '#2563eb',
		},
	},
	plugins: [typography()],
})

See API Reference — Plugin Typography for full type signatures and defaults.

Next

  • Icons — icon integration via Iconify.
  • Fonts — web font loading.