Home / Function/ add() — tailwindcss Function Reference

add() — tailwindcss Function Reference

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

Function typescript OxideCore Scanner calls 2 called by 16

Entity Profile

Dependency Diagram

graph TD
  24d95be4_356f_a1f9_9702_2a4f413db0f5["add()"]
  a6e11c3d_c962_0a65_d91f_6fbe955cf4f0["optimizeAst()"]
  a6e11c3d_c962_0a65_d91f_6fbe955cf4f0 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  eebd49be_6bf6_0e23_60fa_4e12a1151233["isVariableUsed()"]
  eebd49be_6bf6_0e23_60fa_4e12a1151233 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  74a4389f_06f5_9213_9ee9_31f7f355cad8["canonicalizeCandidates()"]
  74a4389f_06f5_9213_9ee9_31f7f355cad8 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  830bd29f_3420_9239_4bdf_20fd57106bdf["collapseCandidates()"]
  830bd29f_3420_9239_4bdf_20fd57106bdf -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  9b136014_1c89_69bd_c68a_71707da43497["tryValueReplacements()"]
  9b136014_1c89_69bd_c68a_71707da43497 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  3c29a5ca_8e68_4fa2_4e91_392cf24c5a01["canonicalizeAst()"]
  3c29a5ca_8e68_4fa2_4e91_392cf24c5a01 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  88e17ede_e457_4c87_d3c8_c491a1795810["resolveVariablesInValue()"]
  88e17ede_e457_4c87_d3c8_c491a1795810 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  69cc8435_e606_a151_8be0_cd5f1378ad52["createUtilityPropertiesCache()"]
  69cc8435_e606_a151_8be0_cd5f1378ad52 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  affaaffb_bbfa_d683_8871_14297c28e46f["temporarilyDisableThemeInline()"]
  affaaffb_bbfa_d683_8871_14297c28e46f -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  0a0af711_c5b8_1a31_60fe_678ff9771f13["applyConfigToTheme()"]
  0a0af711_c5b8_1a31_60fe_678ff9771f13 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  95cb326e_6b59_0903_0c96_d221fca5c2b1["parseCss()"]
  95cb326e_6b59_0903_0c96_d221fca5c2b1 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  f5e443d2_a934_36af_23f2_b1c002aaa585["compileAst()"]
  f5e443d2_a934_36af_23f2_b1c002aaa585 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  36ae79a2_b20d_13c7_4f6b_8f43bb0d702f["loadDesignSystem()"]
  36ae79a2_b20d_13c7_4f6b_8f43bb0d702f -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  4bf69ed2_937e_8db8_e3d5_dbd0af3cc6e4["simpleDesign()"]
  4bf69ed2_937e_8db8_e3d5_dbd0af3cc6e4 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  style 24d95be4_356f_a1f9_9702_2a4f413db0f5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/theme.ts lines 60–86

  add(key: string, value: string, options = ThemeOptions.NONE, src?: Declaration['src']): void {
    if (key.endsWith('-*')) {
      if (value !== 'initial') {
        throw new Error(`Invalid theme value \`${value}\` for namespace \`${key}\``)
      }
      if (key === '--*') {
        this.values.clear()
      } else {
        this.clearNamespace(
          key.slice(0, -2),
          // `--${key}-*: initial;` should clear _all_ theme values
          ThemeOptions.NONE,
        )
      }
    }

    if (options & ThemeOptions.DEFAULT) {
      let existing = this.values.get(key)
      if (existing && !(existing.options & ThemeOptions.DEFAULT)) return
    }

    if (value === 'initial') {
      this.values.delete(key)
    } else {
      this.values.set(key, { value, options, src })
    }
  }

Domain

Subdomains

Frequently Asked Questions

What does add() do?
add() is a function in the tailwindcss codebase.
What does add() call?
add() calls 2 function(s): clearNamespace, get.
What calls add()?
add() is called by 16 function(s): addKeyframes, applyConfigToTheme, canonicalizeAst, canonicalizeCandidates, collapseCandidates, compileAst, createCssUtility, createUtilityPropertiesCache, and 8 more.

Analyze Your Own Codebase

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

Try Supermodel Free