list.append() belongs to the built-in sass:list module. It returns a copy of a list with one value added at the end. This page covers separators, nesting vs joining, module loading, Dart Sass support, and five compiled examples.
01
Concept
Add to the end
02
Module
@use "sass:list"
03
Separator
auto / comma / space
04
Nesting
Lists stay nested
05
Vs join
append ≠ join
06
Practice
5 examples
Concept
What Is list.append()?
Think of a shopping list: append means “add one more item at the bottom.” Sass does the same for space-separated or comma-separated lists while compiling your stylesheet.
list.append(10px 20px, 30px) → 10px 20px 30px
list.append((blue, red), green) → blue, red, green
list.append(10px 20px, 30px 40px) → 10px 20px (30px 40px)
💡
Beginner tip
The original list is not mutated. You usually reassign: $sizes: list.append($sizes, 30px); Browsers never see list.append—only the finished CSS values.
The list to copy. Maps and single values also count as lists in Sass.
$val
Any
Yes
The value added at the end. If it is a list, it is nested as one item.
$separator
auto | comma | space | slash
No
Default auto keeps $list’s separator (or space if none).
Return value
Type
Meaning
List
A new list: all items from $list, then $val as the last item.
Modules
📦 Loading sass:list
Modern Sass groups list helpers into the sass:list module. Prefer the namespaced form in new code.
styles.scss
// Recommended — namespaced
@use "sass:list";
$sizes: list.append(10px 20px, 30px);
// Optional — bring members into scope
@use "sass:list" as *;
$sizes: append(10px 20px, 30px);
// Optional — custom namespace
@use "sass:list" as l;
$sizes: l.append(10px 20px, 30px);
⚠️
Put @use first
Keep @use "sass:list"; near the top of the file, before most other rules.
Details
🔗 Separators: Space, Comma, Slash
CSS uses different separators for different jobs: spaces in margin: 10px 20px 30px, commas in font-family: Helvetica, Arial, sans-serif. $separator controls which style the returned list uses.
Forgetting to reassign — list.append($s, 1) alone does not update $s.
Expecting flatten — appending a list nests it; use list.join to merge elements.
Wrong separator — font stacks need commas; shorthands usually need spaces.
Forgetting @use — list.append is undefined until you load sass:list.
LibSass pipelines — built-in modules need Dart Sass; use global append() carefully on legacy tooling.
Pro Tips
💡 Best Practices
✅ Do
Use @use "sass:list" and list.append() in new SCSS
Reassign when growing a variable: $list: list.append($list, $item)
Choose $separator to match the CSS property
Prefer append over join for a single new value
Check results with @debug or meta.inspect while learning
❌ Don’t
Expect the browser to evaluate list.append
Use join when you meant to nest a sub-list as one item
Mix comma and space lists without an intentional $separator
Rely on LibSass for @use "sass:list"
Forget that single values also count as one-item lists
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about list.append()
Compile-time “add one item”—nested if that item is a list.
5
Core concepts
📝01
Call
list.append($list, $val)
API
📦02
Module
sass:list
@use
🔗03
Separator
auto / comma / space
CSS
📁04
Lists as $val
nested
Gotcha
✓05
Prefer
Dart Sass 1.23+
Tooling
❓ Frequently Asked Questions
list.append($list, $val, $separator: auto) returns a copy of $list with $val added at the end. Example: list.append(10px 20px, 30px) is 10px 20px 30px.
append adds one value (and nests it if that value is a list). join concatenates two lists element-by-element. Official docs recommend append when adding a single value.
It sets the returned list’s separator: comma, space, or slash. The default auto keeps $list’s separator (or space if $list has none).
No. Sass lists are immutable for these helpers—you get a new list. Reassign if you want to keep growing a variable: $sizes: list.append($sizes, 30px);
Yes. Global append($list, $val) still works. New projects should prefer list.append() after @use "sass:list".
Built-in modules with @use need Dart Sass 1.23+. LibSass and Ruby Sass do not load sass:list the same way—use the global append() name there if you must.
Did you know?
Official Sass docs note that every map counts as a list of two-element pairs, and a lone value like 1px counts as a one-item list. That is why list.append(10px, 20px) works even when the first argument does not look like a multi-value list.
list.append() is the reliable way to add one value to the end of a Sass list at compile time. Load it through sass:list, reassign when growing tokens, pick the right $separator, and remember that a list-valued $val stays nested.