Skip to content

Arbitrary Variants Extractor

A more complex extractor to support arbitrary variants for utilities.

html
<div class="[&>*]:m-1 [&[open]]:p-2"></div>

Will be captured with [&>*]:m-1 and [&[open]]:p-2 as variants.

This extractor is included in @unocss/preset-mini as the default extractor. Normally you don't need to install this package manually.

Installation

bash
pnpm add -D @unocss/extractor-arbitrary-variants
bash
yarn add -D @unocss/extractor-arbitrary-variants
bash
npm install -D @unocss/extractor-arbitrary-variants
uno.config.ts
ts
import extractorArbitrary from '@unocss/extractor-arbitrary-variants'
import { defineConfig } from 'unocss'

export default defineConfig({
  extractors: [
    extractorArbitrary(),
  ],
})

Released under the MIT License.