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
  e33fde8c_3981_b99b_dd14_da5b61b9d781["isBackgroundPosition()"]
  2a20ea29_c850_cd61_5600_aeebbe3dda66["segment()"]
  e33fde8c_3981_b99b_dd14_da5b61b9d781 -->|calls| 2a20ea29_c850_cd61_5600_aeebbe3dda66
  f09c1b77_2ead_f9c9_7d05_4f8bab47f7ca["isLength()"]
  e33fde8c_3981_b99b_dd14_da5b61b9d781 -->|calls| f09c1b77_2ead_f9c9_7d05_4f8bab47f7ca
  94b3e523_3675_a597_3668_598a53b432d1["isPercentage()"]
  e33fde8c_3981_b99b_dd14_da5b61b9d781 -->|calls| 94b3e523_3675_a597_3668_598a53b432d1
  style e33fde8c_3981_b99b_dd14_da5b61b9d781 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
}

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