meta.calc-args() belongs to the built-in sass:meta module. It returns the argument list inside a CSS calculation such as calc(), clamp(), min(), or max(). This page covers argument types, official samples, nesting, pairing with list helpers, Dart Sass 1.40+, and five examples.
01
Concept
Inspect calc args
02
Module
@use "sass:meta"
03
Returns
Argument list
04
Types
Number / calc / string
05
Works on
calc, clamp, min, max
06
Practice
5 examples
Concept
What Is meta.calc-args()?
Modern CSS uses calculation functions like calc() and clamp(). In Sass, those values are a special calculation type. Sometimes you need to look inside them—count arguments, read a min/max bound, or rebuild a new calc. Official docs: meta.calc-args($calc) returns the arguments for the given calculation.
Numbers stay numbers (for example 50px)
Nested calculations stay calculation values
Anything else becomes an unquoted string (for example var(--width) or 100px + 10%)
💡
Beginner tip
Think of opening a labeled box (clamp) and listing what is inside (min, preferred, max). meta.calc-name reads the label; meta.calc-args lists the contents.
Foundation
📝 Syntax
Load the meta module, then call the function:
styles.scss
@use "sass:meta";
meta.calc-args($calc)
Parameters
Parameter
Type
Required
Description
$calc
Calculation
Yes
A CSS calculation value such as calc(...), clamp(...), min(...), or max(...).
Return value
Type
Argument kind
Returned as
List item
Number
Number (keeps units)
List item
Nested calculation
Calculation value
List item
Anything else
Unquoted string
Modules
📦 Loading sass:meta
styles.scss
// Recommended — namespaced
@use "sass:meta";
$args: meta.calc-args(clamp(1rem, 2vw, 3rem));
// Optional — bring members into scope
@use "sass:meta" as *;
$args: calc-args(clamp(1rem, 2vw, 3rem));
// Optional — custom namespace
@use "sass:meta" as m;
$args: m.calc-args(clamp(1rem, 2vw, 3rem));
Details
🔢 How Arguments Are Typed
Official samples show both shapes clearly:
styles.scss
@use "sass:meta";
// One expression → one unquoted string
meta.calc-args(calc(100px + 10%));
// unquote("100px + 10%")
// Separate args → mix of numbers and strings
meta.calc-args(clamp(50px, var(--width), 1000px));
// 50px, unquote("var(--width)"), 1000px
clamp / min / max usually expose multiple list items
A single calc(a + b) expression often collapses to one string item
Use list.nth / list.length to work with the result
Compare
📋 meta.calc-args vs meta.calc-name
meta.calc-args
meta.calc-name
Returns
List of arguments
Quoted name ("calc", "clamp", …)
Best for
Reading / transforming inputs
Branching on calculation kind
Since
Dart Sass 1.40+
Dart Sass 1.40+
Support
🛠 Compatibility
This is about Sass compilers, not browsers. Inspection happens at compile time; browsers only see any CSS you rebuild from the pieces.
Implementation
meta.calc-args()
Notes
Dart Sass (1.40+)
Yes — required
Calculation introspection helpers
LibSass
No
No modern calc meta API
Ruby Sass
No
Legacy—prefer Dart Sass
Cheat Sheet
⚡ Quick Reference
Goal
Code
Import meta
@use "sass:meta";
List arguments
meta.calc-args($calc)
First argument
list.nth(meta.calc-args($calc), 1)
How many args
list.length(meta.calc-args($calc))
Calculation name
meta.calc-name($calc)
Minimum Dart Sass
1.40+
Hands-On
Examples Gallery
Each example uses @use "sass:meta". Open View Compiled CSS for verified output (official samples where noted).
📚 Getting Started
Official docs samples for calc and clamp.
Example 1 — calc() Expression (Official Docs)
A mixed-unit expression becomes one unquoted string argument.
Arguments 1 and 3 are numbers. The preferred middle value is an expression, so it ships as an unquoted string while the original $fluid still compiles to CSS clamp().
Example 4 — Nested Calculation Argument
A nested calc() stays a calculation value in the list.
Three inputs to min() produce a three-item list from meta.calc-args.
Applications
🚀 Real-World Use Cases
Fluid type tooling — expose clamp min / preferred / max as CSS variables for docs or themes.
Token validation — assert a clamp has three arguments before emitting utilities.
Nested calc rewriting — walk nested calculations and rebuild adjusted expressions.
Design-system debugging — @debug meta.calc-args($token) while tuning scales.
Pair with calc-name — branch on clamp vs min then inspect args.
🧠 How Compilation Works
1
Build a calculation
Write calc(), clamp(), min(), or max() in SCSS.
Source
2
Call calc-args
Dart Sass opens the calculation and builds an argument list.
Compile
3
Typed list items
Numbers and nested calcs keep types; other pieces become unquoted strings.
Inspect
4
✓
Use or emit CSS
Transform args with list helpers, or keep the original calculation in CSS.
Watch Out
⚠️ Common Pitfalls
Passing a plain number — 10px is not a calculation; wrap it in calc()/clamp()/min()/max().
Expecting split math — calc(100px + 10%) is one string arg, not two numbers.
Treating var() as a number — custom properties arrive as unquoted strings.
Old Dart Sass — need 1.40+ for calculation introspection.
Forgetting list helpers — the return value is a list; use list.nth / list.length.
Pro Tips
💡 Best Practices
✅ Do
Use @use "sass:meta" and meta.calc-args()
Pair with meta.calc-name when kind matters
Use list.nth for clamp bounds
Recurse into nested calculation args when needed
Prefer Dart Sass 1.40+
❌ Don’t
Expect the browser to evaluate meta.calc-args
Pass non-calculation values
Assume every arg is a Sass number
Forget that expressions may be one unquoted string
Rely on LibSass / Ruby Sass for this API
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about meta.calc-args()
Open a calculation—get a typed argument list at compile time.
5
Core concepts
📝01
Call
meta.calc-args($calc)
API
📦02
Module
sass:meta
@use
🔢03
Returns
argument list
Rule
❓04
Else type
unquoted string
Safe
✓05
Prefer
Dart Sass 1.40+
Tooling
❓ Frequently Asked Questions
meta.calc-args($calc) returns a list of the arguments inside a CSS calculation value such as calc(), clamp(), min(), or max(). Use it to inspect or transform those arguments at compile time.
Official docs: if an argument is a number or a nested calculation, it is returned as that type. Otherwise it is returned as an unquoted string—for example var(--width) or an expression like 100px + 10%.
That calc() call has a single expression argument. Sass cannot split mixed-unit math into separate number args, so the whole expression becomes one unquoted string.
meta.calc-name($calc) returns the calculation’s name as a quoted string (calc, clamp, min, …). meta.calc-args returns the argument list inside that calculation.
No. Pass a calculation value. Plain lengths like 10px are numbers, not calculations—wrap or build a calc()/clamp()/min()/max() first.
Dart Sass 1.40+. LibSass and Ruby Sass do not provide this helper. Prefer current Dart Sass.
Did you know?
Official Sass docs show calc(100px + 10%) and clamp(50px, var(--width), 1000px) side by side so you can see both return shapes: one collapsed expression string versus a multi-item list with numbers and var().
meta.calc-args() opens CSS calculations at compile time and returns their arguments as a list—numbers and nested calcs preserved, everything else as unquoted strings. Load it through sass:meta on Dart Sass 1.40+, and pair it with list helpers (and meta.calc-name) when building fluid design tokens.