CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-unocss--preset-wind

Tailwind / Windi CSS compact preset for UnoCSS that provides comprehensive utility classes and theming system

Pending
Overview
Eval results
Files

preset.mddocs/

Preset Configuration

The main preset factory function and configuration options for UnoCSS Preset Wind.

Capabilities

Preset Wind Function

Creates a complete UnoCSS preset with Tailwind CSS compatibility, combining rules, theme, shortcuts, variants, and postprocessors.

/**
 * The Tailwind CSS / Windi CSS compact preset for UnoCSS.
 * 
 * @param options - Configuration options for the preset
 * @returns Complete UnoCSS preset object
 * @see https://unocss.dev/presets/wind
 */
function presetWind(options?: PresetWindOptions): Preset;

interface PresetWindOptions extends PresetMiniOptions {
  /**
   * The important option lets you control whether UnoCSS's utilities should be marked with `!important`.
   *
   * This can be really useful when using UnoCSS with existing CSS that has high specificity selectors.
   *
   * You can also set `important` to a selector like `#app` instead, which will generate `#app :is(.m-1) { ... }`
   *
   * Also check out the compatibility with [:is()](https://caniuse.com/?search=%3Ais())
   *
   * @default false
   */
  important?: boolean | string;
}

interface Preset {
  name: string;
  theme: Theme;
  rules: Rule<Theme>[];
  shortcuts: Shortcut<Theme>[];
  variants: Variant[];
  postprocess: Postprocessor[];
}

Usage Examples:

import { defineConfig } from "unocss";
import { presetWind } from "@unocss/preset-wind";

// Basic usage with default options
export default defineConfig({
  presets: [presetWind()],
});

// With important enabled globally
export default defineConfig({
  presets: [
    presetWind({
      important: true,
    }),
  ],
});

// With selector-scoped important
export default defineConfig({
  presets: [
    presetWind({
      important: "#app",
    }),
  ],
});

// Combining with other UnoCSS presets
export default defineConfig({
  presets: [
    presetWind({
      important: false,
    }),
    // other presets...
  ],
});

Default Export

The preset function is also available as the default export.

/**
 * Default export of the presetWind function
 */
const presetWindDefault: typeof presetWind;
export default presetWindDefault;

Usage Example:

import presetWind from "@unocss/preset-wind";

export default defineConfig({
  presets: [presetWind()],
});

Important Option Behavior

The important option controls CSS specificity handling:

Boolean Mode (important: true):

  • Adds !important to all generated CSS properties
  • Example: .m-4 { margin: 1rem !important; }

Selector Mode (important: "#app"):

  • Wraps utilities with the specified selector using :is()
  • Example: #app :is(.m-4) { margin: 1rem; }
  • Handles pseudo-elements correctly: #app :is(.btn)::before { content: ""; }

Default Mode (important: false or omitted):

  • No special handling applied
  • Example: .m-4 { margin: 1rem; }

Individual Component Exports

The preset exports individual components for advanced usage and customization.

/**
 * Individual component exports from preset-wind
 */
const rules: Rule<Theme>[];
const theme: Theme;
const shortcuts: Shortcut<Theme>[];
function variants(options: PresetWindOptions): Variant<Theme>[];
function postprocessors(options: PresetWindOptions): Postprocessor[];

// Re-exported from preset-mini
const colors: ColorTheme;
const preflights: Preflight[];
type Theme = PresetMiniTheme;

Usage Example:

import { rules, theme, shortcuts, variants, postprocessors } from "@unocss/preset-wind";
import { defineConfig } from "unocss";

// Create custom preset using individual components
export default defineConfig({
  presets: [
    {
      name: 'custom-wind-preset',
      theme,
      rules,
      shortcuts,
      variants: variants({ important: false }),
      postprocess: postprocessors({ important: true })
    }
  ],
});

Install with Tessl CLI

npx tessl i tessl/npm-unocss--preset-wind

docs

index.md

postprocessors.md

preset.md

rules.md

shortcuts.md

theme.md

variants.md

tile.json