MCPcopy
hub / github.com/tailwindlabs/tailwindcss / staticVariant

Function staticVariant

packages/tailwindcss/src/variants.ts:358–372  ·  view source on GitHub ↗

* Register a static variant like `hover`.

(
    name: string,
    selectors: string[],
    { compounds }: { compounds?: Compounds } = {},
  )

Source from the content-addressed store, hash-verified

356 * Register a static variant like `hover`.
357 */
358 function staticVariant(
359 name: string,
360 selectors: string[],
361 { compounds }: { compounds?: Compounds } = {},
362 ) {
363 compounds = compounds ?? compoundsForSelectors(selectors)
364
365 variants.static(
366 name,
367 (r) => {
368 r.nodes = selectors.map((selector) => rule(selector, r.nodes))
369 },
370 { compounds },
371 )
372 }
373
374 staticVariant('*', [':is(& > *)'], { compounds: Compounds.Never })
375 staticVariant('**', [':is(& *)'], { compounds: Compounds.Never })

Callers 1

createVariantsFunction · 0.85

Calls 3

ruleFunction · 0.90
compoundsForSelectorsFunction · 0.85
staticMethod · 0.45

Tested by

no test coverage detected