Home / Function/ set() — tailwindcss Function Reference

set() — tailwindcss Function Reference

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

Function typescript Oxide Scanner calls 2 called by 8

Entity Profile

Dependency Diagram

graph TD
  ab94dcde_768f_3d99_6111_8043865014ab["set()"]
  67c140cd_3928_7c30_7f6d_c67052da2a02["Variants"]
  ab94dcde_768f_3d99_6111_8043865014ab -->|defined in| 67c140cd_3928_7c30_7f6d_c67052da2a02
  ad08c258_e5c2_4cd4_c935_0925a940458e["compileCandidates()"]
  ad08c258_e5c2_4cd4_c935_0925a940458e -->|calls| ab94dcde_768f_3d99_6111_8043865014ab
  e557c8a4_bb27_ee44_c462_9e238157ad04["buildDesignSystem()"]
  e557c8a4_bb27_ee44_c462_9e238157ad04 -->|calls| ab94dcde_768f_3d99_6111_8043865014ab
  f7f9b3da_5977_1aa6_3bcb_bfc607af4e8f["parseCss()"]
  f7f9b3da_5977_1aa6_3bcb_bfc607af4e8f -->|calls| ab94dcde_768f_3d99_6111_8043865014ab
  303a143d_958a_fac9_a18f_3ccf6d97d00a["static()"]
  303a143d_958a_fac9_a18f_3ccf6d97d00a -->|calls| ab94dcde_768f_3d99_6111_8043865014ab
  6cc289c0_7885_e683_1053_2adb14a9ae30["functional()"]
  6cc289c0_7885_e683_1053_2adb14a9ae30 -->|calls| ab94dcde_768f_3d99_6111_8043865014ab
  1414bfb2_d251_dd0b_535b_ae5531c73cdb["compound()"]
  1414bfb2_d251_dd0b_535b_ae5531c73cdb -->|calls| ab94dcde_768f_3d99_6111_8043865014ab
  15fe2878_a9ae_f5b5_2f4c_e3238b9272fe["group()"]
  15fe2878_a9ae_f5b5_2f4c_e3238b9272fe -->|calls| ab94dcde_768f_3d99_6111_8043865014ab
  63f70e1f_5643_1fef_598f_bc750c0d8c88["suggest()"]
  63f70e1f_5643_1fef_598f_bc750c0d8c88 -->|calls| ab94dcde_768f_3d99_6111_8043865014ab
  893d14c3_e93d_d4ba_2fdd_de2331f8f26d["nextOrder()"]
  ab94dcde_768f_3d99_6111_8043865014ab -->|calls| 893d14c3_e93d_d4ba_2fdd_de2331f8f26d
  553e63f4_f172_3689_a5a7_f8cf3b0bd124["get()"]
  ab94dcde_768f_3d99_6111_8043865014ab -->|calls| 553e63f4_f172_3689_a5a7_f8cf3b0bd124
  style ab94dcde_768f_3d99_6111_8043865014ab 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,
      })
    }
  }

Domain

Subdomains

Frequently Asked Questions

What does set() do?
set() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/variants.ts.
Where is set() defined?
set() is defined in packages/tailwindcss/src/variants.ts at line 280.
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