Home / Function/ set() — tailwindcss Function Reference

set() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  13f9b85f_58c4_5390_3b22_04d00b93361b["set()"]
  cbdeac33_581c_3396_0f10_877935a68176["compileCandidates()"]
  cbdeac33_581c_3396_0f10_877935a68176 -->|calls| 13f9b85f_58c4_5390_3b22_04d00b93361b
  cebe77e1_f0f2_aeee_417e_2192f5790344["buildDesignSystem()"]
  cebe77e1_f0f2_aeee_417e_2192f5790344 -->|calls| 13f9b85f_58c4_5390_3b22_04d00b93361b
  26086ff1_0d4f_fdb2_3fc4_d0c999f90a8c["parseCss()"]
  26086ff1_0d4f_fdb2_3fc4_d0c999f90a8c -->|calls| 13f9b85f_58c4_5390_3b22_04d00b93361b
  8b8b27d7_26d3_a7b8_edd4_3858daa755ac["static()"]
  8b8b27d7_26d3_a7b8_edd4_3858daa755ac -->|calls| 13f9b85f_58c4_5390_3b22_04d00b93361b
  d657fe4b_1aa1_3869_f6e6_3b0086c85983["functional()"]
  d657fe4b_1aa1_3869_f6e6_3b0086c85983 -->|calls| 13f9b85f_58c4_5390_3b22_04d00b93361b
  8711d3c6_2537_4267_acab_f8fa7a5ab188["compound()"]
  8711d3c6_2537_4267_acab_f8fa7a5ab188 -->|calls| 13f9b85f_58c4_5390_3b22_04d00b93361b
  3ea38218_2a7c_f912_d458_de38bb3579b6["group()"]
  3ea38218_2a7c_f912_d458_de38bb3579b6 -->|calls| 13f9b85f_58c4_5390_3b22_04d00b93361b
  e69fc175_885d_a758_85b9_9613d68e20bf["suggest()"]
  e69fc175_885d_a758_85b9_9613d68e20bf -->|calls| 13f9b85f_58c4_5390_3b22_04d00b93361b
  2b0dbe06_2831_8f0b_4be1_7341d5b885d8["nextOrder()"]
  13f9b85f_58c4_5390_3b22_04d00b93361b -->|calls| 2b0dbe06_2831_8f0b_4be1_7341d5b885d8
  395d4822_c2e4_54d6_7a44_627f1105fbeb["get()"]
  13f9b85f_58c4_5390_3b22_04d00b93361b -->|calls| 395d4822_c2e4_54d6_7a44_627f1105fbeb
  style 13f9b85f_58c4_5390_3b22_04d00b93361b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/variants.ts lines 280–312

  private set<T extends Variant['kind']>(
    name: string,
    {
      kind,
      applyFn,
      compounds,
      compoundsWith,
      order,
    }: {
      kind: T
      applyFn: VariantFn<T>
      compoundsWith: Compounds
      compounds: Compounds
      order?: number
    },
  ) {
    let existing = this.variants.get(name)
    if (existing) {
      Object.assign(existing, { kind, applyFn, compounds })
    } else {
      if (order === undefined) {
        this.lastOrder = this.nextOrder()
        order = this.lastOrder
      }
      this.variants.set(name, {
        kind,
        applyFn,
        order,
        compoundsWith,
        compounds,
      })
    }
  }

Subdomains

Frequently Asked Questions

What does set() do?
set() is a function in the tailwindcss codebase.
What does set() call?
set() calls 2 function(s): get, nextOrder.
What calls set()?
set() is called by 8 function(s): buildDesignSystem, compileCandidates, compound, functional, group, parseCss, static, suggest.

Analyze Your Own Codebase

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

Try Supermodel Free