meta.accepts-content() belongs to the built-in sass:meta module. It returns whether a mixin value can accept a @content block. This page covers pairing it with meta.get-mixin and meta.apply, what “possible” means, Dart Sass 1.69+, and five compiled examples.
01
Concept
Can mixin take content?
02
Module
@use "sass:meta"
03
Input
Mixin value
04
Result
true / false
05
With apply
Safe content forward
06
Practice
5 examples
Concept
What Is meta.accepts-content()?
Some mixins are written to receive nested CSS through a @content block:
Other mixins never declare @content. When you work with mixin values (from meta.get-mixin) and include them via meta.apply, you may not know ahead of time whether forwarding a content block is allowed. meta.accepts-content($mixin) answers that with a boolean.
Returns true if the mixin can accept @content
Official docs: true even if the mixin does not always use the block
Returns false for mixins that cannot take content
💡
Beginner tip
Think of asking “Does this tool have a slot for extra pieces?” before you try to attach a content block with meta.apply.
Foundation
📝 Syntax
Load the meta module, then call the function:
styles.scss
@use "sass:meta";
meta.accepts-content($mixin)
Parameters
Parameter
Type
Required
Description
$mixin
Mixin value
Yes
Mixin to inspect. Usually from meta.get-mixin($name) (or meta.module-mixins).
Return value
Type
Situation
Result
Boolean
Mixin can accept @content
true (even if content is not always used)
Boolean
Mixin cannot accept @content
false
Modules
📦 Loading sass:meta
There is no legacy global accepts-content(). Load the meta module, then call the namespaced function.
styles.scss
// Recommended — namespaced
@use "sass:meta";
$ok: meta.accepts-content(meta.get-mixin("card"));
// Optional — bring members into scope
@use "sass:meta" as *;
$ok: accepts-content(get-mixin("card"));
// Optional — custom namespace
@use "sass:meta" as m;
$ok: m.accepts-content(m.get-mixin("card"));
⚠️
Put @use first
Keep @use "sass:meta"; near the top of the file, before most other rules.
Details
🔗 Pair with get-mixin and apply
These three helpers work as a set (all Dart Sass 1.69+ for mixin values):
Helper
Role
meta.get-mixin($name)
Resolve a mixin value by name
meta.accepts-content($mixin)
Ask if that value can take @content
@include meta.apply($mixin, …)
Include the mixin (optionally with a content block)
Official wording matters: the function returns true if it is possible for the mixin to accept a content block, even if it does not always do so. Treat true as “safe to pass content,” not “content is required.”
true — you may forward @content via meta.apply
false — do not pass a content block; include the mixin without one
Support
🛠 Compatibility
This is about Sass compilers, not browsers. The check runs at compile time.
Implementation
meta.accepts-content()
Notes
Dart Sass (1.69+)
Yes — required
Ships with mixin values / meta.apply
LibSass
No
No modern mixin-value API
Ruby Sass
No
Legacy—prefer Dart Sass
Cheat Sheet
⚡ Quick Reference
Goal
Code
Import meta
@use "sass:meta";
Get mixin value
meta.get-mixin("name")
Check content support
meta.accepts-content($m)
Include with content
@include meta.apply($m) { ... }
Include without content
@include meta.apply($m, $args...);
Minimum Dart Sass
1.69+
Hands-On
Examples Gallery
Each example uses @use "sass:meta". Open View Compiled CSS to see what Dart Sass emits (booleans shown via custom properties where helpful).
Call meta.get-mixin("name") (or receive a mixin value as an argument).
Source
2
Ask accepts-content
Dart Sass inspects whether that mixin can take a @content block.
Compile
3
Branch your include
Use meta.apply with or without a content block based on the boolean.
Apply
4
✓
Plain CSS ships
Browsers never see the check—only the finished CSS from the mixin.
Watch Out
⚠️ Common Pitfalls
Passing a string — use a mixin value from meta.get-mixin, not "panel" alone.
Reading true as “required” — true means content is possible, not mandatory.
Skipping the guard — forwarding content to a non-accepting mixin can error; check first in generic helpers.
Old Dart Sass — need 1.69+ for mixin values and this function.
Confusing with functions — this inspects mixins; functions use meta.call, not content blocks.
Pro Tips
💡 Best Practices
✅ Do
Use @use "sass:meta" and meta.accepts-content()
Resolve mixins with meta.get-mixin first
Guard content forwarding in higher-order helpers
Pair with meta.apply for dynamic includes
Prefer Dart Sass 1.69+
❌ Don’t
Expect the browser to evaluate meta.accepts-content
Pass a bare string as $mixin
Assume true means content is always consumed
Blindly attach @content to every meta.apply
Rely on LibSass / Ruby Sass for this API
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about meta.accepts-content()
Boolean capability check for mixin @content—Dart Sass 1.69+.
5
Core concepts
📝01
Call
meta.accepts-content($m)
API
📦02
Module
sass:meta
@use
✅03
Returns
true / false
Rule
❓04
Meaning
can accept content
Safe
✓05
Prefer
Dart Sass 1.69+
Tooling
❓ Frequently Asked Questions
meta.accepts-content($mixin) returns true or false for whether a mixin value can accept a @content block. Official docs: it returns true if accepting content is possible, even when the mixin does not always use @content.
A mixin value—usually from meta.get-mixin("name"), or from meta.module-mixins. Do not pass a plain string name.
When you write higher-order helpers that @include meta.apply($mixin) and sometimes forward @content. Check accepts-content first so you only pass a content block to mixins that support it.
No. true means it is possible for the mixin to accept content. The mixin might use @content only on some code paths.
meta.apply can forward a @content block into the applied mixin. meta.accepts-content tells you whether that is safe/possible for a given mixin value.
Dart Sass 1.69+. LibSass and Ruby Sass do not provide this helper. Prefer current Dart Sass.
Did you know?
Official Sass docs place meta.accepts-content with the other mixin-value tools that landed in Dart Sass 1.69—right beside meta.apply and meta.get-mixin—because dynamic includes often need a content capability check.
meta.accepts-content() is a small but important guard for dynamic mixin workflows: resolve a mixin value, ask whether @content is possible, then meta.apply with or without a content block. Load it through sass:meta on Dart Sass 1.69+.