Skip to content

Engine Config

The engine configuration controls every aspect of PikaCSS. Create a pika.config.ts (or .js) in your project root — the plugin does not create one for you unless you opt in with autoCreateConfig: true (see Setup). Never keep both a pika.config.ts and pika.config.js: config discovery loads the highest-priority root-level candidate and ignores the rest.

ts
import { defineEngineConfig } from '@pikacss/core'

export default defineEngineConfig({
  // options here
})

Config

Core

PropertyDescription
prefixClass name prefix prepended to every generated atomic class name. Default: 'pk-'.
defaultSelectorCSS selector template for atomic styles. % is replaced with the generated atomic class ID, so the template must contain %. Default: '.%'.
pluginsArray of engine plugins to load in resolution order. See Plugin Development.
layersMap of CSS @layer names to numeric priorities. Lower numbers render earlier. See Layers.
defaultPreflightsLayerLayer name for preflight styles. Default: 'preflights'.
defaultUtilitiesLayerLayer name for atomic utility styles. Default: 'utilities'.
preflightsBase styles injected before utilities. See Preflights.
cssImportsArray of CSS @import rules included at the top of generated output.
importantWhen set to { default: true }, all generated declarations include !important. See Important.

Two placeholders

% is the atomic class ID slot used inside defaultSelector (e.g. '.%' becomes .pk-a), while $ is the nested-selector slot used inside style definitions and custom selectors — it expands to the whole defaultSelector.

Customizations

PropertyDescription
autocompleteIDE autocomplete configuration. See Autocomplete.
selectorsCustom selector mappings for nested selectors. See Selectors.
shortcutsReusable style definition aliases. See Shortcuts.
variablesCSS custom properties injected under :root. See Variables.
keyframesCSS @keyframes animation definitions. See Keyframes.

Plugin Config

TIP

These fields are added by official plugins via type augmentation. Install the corresponding plugin package to use them.

PropertyDescription
resetSee Reset plugin.
typographySee Typography plugin.
iconsSee Icons plugin.
fontsSee Fonts plugin.
designTokensSee Design Tokens plugin.

See API Reference — Core for full type signatures and defaults.

Examples

ts
import { defineEngineConfig } from '@pikacss/core'

export const selectorsConfig = defineEngineConfig({
	selectors: {
		definitions: [
			['@dark', 'html.dark $'],
			['@light', 'html:not(.dark) $'],
			['@sm', '@media (min-width: 640px)'],
			['@md', '@media (min-width: 768px)'],
			['@lg', '@media (min-width: 1024px)'],
		],
	},
})

Next