Home / Function/ isBackgroundPosition() — tailwindcss Function Reference

isBackgroundPosition() — tailwindcss Function Reference

Architecture documentation for the isBackgroundPosition() function in infer-data-type.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  64006611_5340_1d0a_50e7_914f88e57fe0["isBackgroundPosition()"]
  03b8d706_a876_a776_0056_186ced5d6067["segment()"]
  64006611_5340_1d0a_50e7_914f88e57fe0 -->|calls| 03b8d706_a876_a776_0056_186ced5d6067
  b165f745_465e_eff8_6d0d_8cc7925672fb["isLength()"]
  64006611_5340_1d0a_50e7_914f88e57fe0 -->|calls| b165f745_465e_eff8_6d0d_8cc7925672fb
  2e575c10_95fb_8398_4a75_13426712ebeb["isPercentage()"]
  64006611_5340_1d0a_50e7_914f88e57fe0 -->|calls| 2e575c10_95fb_8398_4a75_13426712ebeb
  style 64006611_5340_1d0a_50e7_914f88e57fe0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/utils/infer-data-type.ts lines 242–268

function isBackgroundPosition(value: string): boolean {
  let count = 0

  for (let part of segment(value, ' ')) {
    if (
      part === 'center' ||
      part === 'top' ||
      part === 'right' ||
      part === 'bottom' ||
      part === 'left'
    ) {
      count += 1
      continue
    }

    if (part.startsWith('var(')) continue

    if (isLength(part) || isPercentage(part)) {
      count += 1
      continue
    }

    return false
  }

  return count > 0
}

Domain

Subdomains

Frequently Asked Questions

What does isBackgroundPosition() do?
isBackgroundPosition() is a function in the tailwindcss codebase.
What does isBackgroundPosition() call?
isBackgroundPosition() calls 3 function(s): isLength, isPercentage, segment.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free