namespace() — tailwindcss Function Reference
Architecture documentation for the namespace() function in theme.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD aa57ed8e_9804_d9ba_b480_f0584cdac61b["namespace()"] 57934fd1_bd18_f9cc_3777_870ee6aa0bf0["readFromCss()"] 57934fd1_bd18_f9cc_3777_870ee6aa0bf0 -->|calls| aa57ed8e_9804_d9ba_b480_f0584cdac61b c067616f_e276_458d_2166_c9f10e6fcc93["createVariants()"] c067616f_e276_458d_2166_c9f10e6fcc93 -->|calls| aa57ed8e_9804_d9ba_b480_f0584cdac61b style aa57ed8e_9804_d9ba_b480_f0584cdac61b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/theme.ts lines 276–293
namespace(namespace: string) {
let values = new Map<string | null, string>()
let prefix = `${namespace}-`
for (let [key, value] of this.values) {
if (key === namespace) {
values.set(null, value.value)
} else if (key.startsWith(`${prefix}-`)) {
// Preserve `--` prefix for sub-variables
// e.g. `--font-size-sm--line-height`
values.set(key.slice(namespace.length), value.value)
} else if (key.startsWith(prefix)) {
values.set(key.slice(prefix.length), value.value)
}
}
return values
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does namespace() do?
namespace() is a function in the tailwindcss codebase.
What calls namespace()?
namespace() is called by 2 function(s): createVariants, readFromCss.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free