spacing() — tailwindcss Function Reference
Architecture documentation for the spacing() function in css-functions.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 85197689_ff6e_4352_2508_452d732d159e["spacing()"] 1648a493_13b2_8170_f86b_607e088d9565["css-functions.ts"] 85197689_ff6e_4352_2508_452d732d159e -->|defined in| 1648a493_13b2_8170_f86b_607e088d9565 style 85197689_ff6e_4352_2508_452d732d159e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/css-functions.ts lines 42–66
function spacing(
designSystem: DesignSystem,
_source: AstNode,
value: string,
...rest: string[]
): string {
if (!value) {
throw new Error(`The --spacing(…) function requires an argument, but received none.`)
}
if (rest.length > 0) {
throw new Error(
`The --spacing(…) function only accepts a single argument, but received ${rest.length + 1}.`,
)
}
let multiplier = designSystem.theme.resolve(null, ['--spacing'])
if (!multiplier) {
throw new Error(
'The --spacing(…) function requires that the `--spacing` theme variable exists, but it was not found.',
)
}
return `calc(${multiplier} * ${value})`
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does spacing() do?
spacing() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/css-functions.ts.
Where is spacing() defined?
spacing() is defined in packages/tailwindcss/src/css-functions.ts at line 42.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free