Home / Function/ dimensions() — tailwindcss Function Reference

dimensions() — tailwindcss Function Reference

Architecture documentation for the dimensions() function in dimensions.ts from the tailwindcss codebase.

Entity Profile

Relationship Graph

Source Code

packages/tailwindcss/src/utils/dimensions.ts lines 6–20

export const dimensions = new DefaultMap((input) => {
  let match = DIMENSION_REGEX.exec(input)
  if (!match) return null

  let value = match.groups?.value
  if (value === undefined) return null

  let valueAsNumber = Number(value)
  if (Number.isNaN(valueAsNumber)) return null

  let unit = match.groups?.unit
  if (unit === undefined) return [valueAsNumber, null] as const

  return [valueAsNumber, unit] as const
})

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free